Print to excel file path

Dear all,

I have one doubt. I have created a report and in which i am using Print to excel functionality. I want to select the path for this Excel File. How to do this?? can i use any Dialog box for this?

Thanks & Regards

Rose

Hi Rose,

You can use the Common Dialog Management codeunit for this e.g. (from migration overview form 8614)

XMLDataFile := CommonDialogMgt.OpenFile(Text003,’’,DefaultFileType::Custom,’*.xml’,Action::Save);

Hi Rose,

Are you talking about SAVEASEXCEL function (through C/AL Code) in classic client?

I am afraid that SAVEASEXCEL/ SAVEASPDF doesn’t work in classic client.

If you are using RTC, then after PREVIEW, you get the option to save as excel/ pdf in that, so better you use that.

You may like to see my previous port:

http://dynamicsuser.net/forums/t/27292.aspx

See the last reply in this post.

Hope this helps

Hi Dave Thanks a lot. As I am a beginner i do not know where to put this code…!!

i am using my code as follows

ExcelBuf.CreateBook;
ExcelBuf.CreateSheet(Text000,Text001,COMPANYNAME,USERID);

So where to use ur code ? in between this or some where else? I didn’t understand how the system take this path for the newly creating excel file.[:O]

please explain…!![:(]

Thanks & Regards

Rose[:)]

Which version of NAV are you using?

Hi,

If you are using NAV2009 RTC, then please go through the following post (last reply to this post):

http://dynamicsuser.net/forums/t/27292.aspx

Thanks .But I am using navision Version 4.0.

See the Report 82 (Export Budget to Excel) as an example.

Table Excel Buffer (Table 370) can be used as a buffer table, it will export the data to excel and from there you can save the report.

Otherwise as already suggested, use Common Dialog Management (CU 412) OpenFile Function.

Hi Rose,

You are calling code in the Excel Buffer table which creates and fills the spreadsheet. The normal way (and the easiest) is then to issue the command

ExcelBuffer.GiveUserControl;

Which launches Excel and the user can SaveAs.

The more advance code is in the excel buffer table and to do a saveas you can write

XlBook._SaveAs(ExcelFile);

where XlBook is an Excel automation but may be a step too far for a beginner as you will need to do call using this automation.

[:D]Thanks Dave. I used the ‘Save’ function instead of ‘Save as’. Because when i use ‘save as’, system is checking if anysuch file name exists there…and shows error if it not finds any.

So by using save function,by default ,system saves the excel file in -‘MyDocuments’ folder.

Anything more i Need to do?

Thanks &Regards

Rose

Thanks a lot .Its worked[Y]

I used - ‘CommonDialogMgt.OpenFile(Text003,’’,DefaultFileType::Custom,’*.xml’,Action::Save);’ inside the XlBook._SaveAs().

Thanks Again[:D]

Regards

Rose

Glad to Help [:D]