Results 1 to 16 of 16

Thread: Desperate! *RESOLVED*

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2002
    Posts
    20

    Desperate! *RESOLVED*

    Will this piece of code not open an excel spreadsheet, write some letters and then close it??
    Private Sub Command1_Click()

    Dim xlapp As Excel.Application
    Dim xlbook As Excel.Workbook
    Dim xlsheet As Excel.Worksheet

    Set xlapp = New Excel.Application
    Set xlbook = xlapp.Workbooks.Add
    Set xlsheet = xlbook.Worksheets.Add

    xlsheet.Cells(3, 1).Value = "ASDFASDFA"
    xlsheet.SaveAs "C:\Documents and Settings\Chris Wilson\Desktop\temp.xls"
    xlapp.Quit
    Set xlapp = Nothing
    Set xlbook = Nothing
    Set xlsheet = Nothing

    End Sub

    When I run it on my 98 machine it crashes at the xlsheet.cells line. I run it on my XP machine and it runs fine?? Anyone got any ideas?
    Last edited by rodman70; Dec 8th, 2002 at 12:44 PM.

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