Results 1 to 4 of 4

Thread: Help with Excel

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2001
    Posts
    30

    Help with Excel

    I searched the entire forum and couldn't get a good answer. I have created an application which stores the information in an Excel file.
    I have created the Excel object inside a form. On the click of a command button an excel file is created and the data is saved. There seems to be no problem if two or more excel file is created. But when I reload that form again and try to create excel file. It gives "_Global failed". The excel application quits only when the program is closed
    The code is

    Dim xls As Object

    Private Sub cmd_Make_Click()
    xls.Workbooks.Add
    xls.Workbooks(1).Activate

    ' Code to write to the Excel sheet
    Worksheets("Sheet1").Cells(1, 1).Value = "Sl. No"

    ActiveWorkbook.SaveAs App.Path & "\Excel\" & strFileName, xlExcel9795
    xls.ActiveWorkbook.Close
    End Sub


    Private Sub Form_Unload(Cancel As Integer)
    xls.Quit
    Set xls = Nothing
    End Sub
    Last edited by cool_coolioin; Dec 13th, 2002 at 08:18 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width