|
-
Dec 7th, 2002, 07:31 PM
#1
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|