Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to export the excel is not called book1?
Message
 
To
20/04/2011 22:49:36
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01507874
Message ID:
01508009
Views:
36
>but if use below code, i must offer path file , then i must save the file first........
>
>How to export the excel and not call book1, if user want to save , then save the file and default the file name call aa......
>Not save the file in direct paht first....
>
>How to change my default Workbook template?
>
>
>XL.ActiveWorkbook.SaveAs(path and name of the file, Format Of The File)
>
Offer the file name BEFORE you start the Excel.
The example is for C# (I just learn it right now :-))
using Excel = Microsoft.Office.Interop.Excel; 


SaveFileDialog dlg = new SaveFileDialog();
dlg.FileName = "YourName";
dlg.Filter = "Excel Workbooks (*.xls)|*.xls";
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
   {
     Excel.Application xlAppl = new Excel.Application();
     Excel.Workbook xlWB;
     Excel.Worksheet xlSheet;
     xlAppl.Visible = true;
     xlWB = xlAppl.Workbooks.Add();
     xlWB.SaveAs(dlg.FileName);
     ....
     // Your code here
   }
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform