|
-
Dec 7th, 2002, 11:59 AM
#1
Thread Starter
Junior Member
Quick question
Can anyone tell me why this code will not work on my 98 machine??
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
It compiles and runs fine on my XP machine but when it encounters the set xlsheet line it gives me a runtime error!!??
-
Dec 7th, 2002, 01:01 PM
#2
-
Dec 7th, 2002, 01:54 PM
#3
Thread Starter
Junior Member
I am running Office 2000 on both machines....this snippet of code I posted I actually wrote on the 98 and received the errors. I then cut an pasted it onto the XP machine and it runs fine. I didn't see any reason why it should not compile and run, simple reference to Excel to open, write some letters, and then close??!!
-
Dec 8th, 2002, 11:56 PM
#4
rodman70,
Thing like this could be easy to miss; One thing that you have to do is make sure that the 98 machine OS and Office has been updated to the latest versions and service packs.
The thing I see the most is that when people install Office they do not apply the updates which have caused many a program to fail. The Office on the XP machine may have automatically been updated and current and that is why it works.
This is just a thought!!! Take a look at the about box of both machines, see what is there.
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
|