Hi to all,
i have a problem in nav, i created a report that exports to excel which i have to merge and center the title column for every specific details. does anyone know how to do such thing here in nav? a sample code will be very much appreciated for i dnt have any idea how to do this. [-o<
Thanks!
chad
0
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
thx for the reply but i really dnt have any idea in macro i am not very used with excel. ](*,) i hope that there's someone here who could post regarding my problem. have u ever tried to do such thing like mine?
Open Excel -> Start Macro Recording -> Do this what Navision should do -> Stop macro recording -> View the VBA source.
These vb code you must "transfer" (not directly) to your C/AL Code. for this, take a look to the excel buffer table in NAV. This is the central function to fill excel.
Here you can add your source.
Also read the VBA Help for your excel version (if it is not on your computer, then it is on your Office product cd and you can install it).
For an example read this (there is the MS Access help file shown): viewtopic.php?f=1&t=31344
regards
i have just saw the code thru macro, but does range in excel buffer exist? so how will i convert the macro code to c/al if theres no range in excel buffer any idea?
here is the code that i generate:
Range("B1:C1").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
As you can see, the range is used there, all the properties are available (you do not need to use Select as in the macro, which first selected the area and then worked with the selected area). The constants like xlBottom you can find e.g. there: http://techsupt.winbatch.com/ts/T000001033005F9.html You need to use the number instead the constant.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
ExcelBuf.AddColumn('PURCHASES',FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn('',FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn('',FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn('',FALSE,'',TRUE,FALSE,TRUE,'');
i want to merge the three columns in my presentation in excel sheet but how will i do such thing if theres no range in excel buffer? i have not used the automation of excel for your info. #-o
ExcelBuf.AddColumn('PURCHASES',FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn('',FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn('',FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn('',FALSE,'',TRUE,FALSE,TRUE,'');
i want to merge the three columns in my presentation in excel sheet but how will i do such thing if theres no range in excel buffer? i have not used the automation of excel for your info. #-o
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
do i need to declare a new excelbuffer? :?:
2) Autofit is function which will autofit e.g. column to values inside. You need to create something similar, only the code will be different because it will call another functions over range. Just look into the code of the function.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Than it is time to learn something to be more familiar with it... ;-) Look at the code, study it, try to understand how it work, than it will be easy to add what you need... 8)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Regards