Here is what I used. But the compiler complains
excel.ActiveWorkbook.SaveAs("c:\\MyWorkbook.xml",excel.XlFileFormat.xlXMLSpreadsheet,
Type.Missing, Type.Missing,Type.Missing, Type.Missing,
excel.XlSaveAsAccessMode.xlNoChange,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,Type.Missing);
excel.XlSaveAsAccessMode.xlNoChange & excel.XlFileFormat.xlXMLSpreadsheet
Any ideas as to what these constant values are? I actually want to save a
normal excel file too!
"Dale Preston" wrote:
> DisplayAlerts = false;
>
> You should also use the SaveAs() method for files previously unsaved and set
> Overwrite to true.
>
> Dale Preston
>
> "JM" <(E-Mail Removed)> wrote in message
> news:6F82B53E-7F47-480B-A82D-(E-Mail Removed)...
> > Hi!
> >
> > I've worked hard to get my data into Excel from a bunch of text files.
> I've
> > opened Excel and dumped the data in. I want to save the
> workbook/spreadsheet
> > but have not set a file name yet in the coding.
> >
> > Running the below code I get a Dialog box that prompts for a file name and
> > path. You know the usual. I don't want this. I want to automate the
> entire
> > process. I want to create a filename that have MVC <Date>.xls.
> >
> > If I cancel the dialog box I get an exception. If I put in a file name I
> > get my file (named as above) but also an additional file book1.xls for
> > example.
> >
> > Is there a way to supress the dialog box and just save the file in the
> > naming convention that I want???
> >
> > //Set default path and filename.
> > excel.DefaultFilePath = (@"C:\");
> > DateTime dtCurrTime = DateTime.Now;
> > string ExcelFile = "MVC " + dtCurrTime.ToShortDateString() + ".xls";
> > excel.Save(ExcelFile);
> > excel.Quit(); // Close Excel
> >
> > Thanks JM
>
>
>
|