Error saving Excel file in Visual Basic 2005

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Speilman_54

    #1

    Error saving Excel file in Visual Basic 2005

    Hi,
    I'm converting an excel Macro into visual basic 2005 express, as I
    don't have a copy of VB 6 and trying to make and executable from it,
    I know this version doesn't have the save file as .exe, but I have a
    3rd party software that will convert vb projects into .exe files. My
    issue is in the the saving of the excel file. The macro bassicly
    imports a tab delimeted file and manipulates the file and then saves
    it, as a template to work from. I'm recieving COMexeption errors on
    saving the file. Here is what I have for the save portion.

    m_XLApp.Applica tion.ActiveWork book.SaveAs(("Z :\Complaint-
    Files
    \Active-EMC-Reports\EMC" _
    & strdate & ".xls"),
    Microsoft.Offic e.Interop.Excel .XlFileFormat.x lWorkbookNormal , "", _
    "", False, False,
    Microsoft.Offic e.Interop.Excel .XlSaveAsAccess Mode.xlNoChange , , , , , )


    This is the error that I recieve.


    System.Runtime. InteropServices .COMException was unhandled
    ErrorCode=-2146827284
    HelpLink="C:\Pr ogram Files\Microsoft Office
    \OFFICE11\1033\ xlmain11.chm"
    Message="The file could not be accessed. Try one of the following:


    I'm not sure if I'm using improper syntax or just missing something.
    Any help would greatly appreciated

Working...