|
-
Jan 18th, 2002, 01:01 PM
#1
Thread Starter
New Member
OLE Automating Portability problems
Hello all,
I wondwer if you can help me, I have some code that works in VBA and vb on my windows xp, office 2000 box, however on my windows 98, office 97 box, it works in VBA (Excel), but not in VB,
Can anyone solve this little one for me?
Heres the code...
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim data As Variant
'On Error GoTo errorhandler
'Set xlApp = New Excel.Application
Set xlApp = Excel.Application
Set xlBook = Excel.Workbooks.Add
Set xlSheet = Excel.Worksheets.Add
xlSheet.Name = "results"
xlApp.Visible = True
xlSheet.Activate
'If this line works i'll through a party
xlSheet.Cells(1, 1).Value = "hello"
'xlBook.Close False
'xlApp.Quit
Set xlApp = Nothing
Set xlBook = Nothing
Set xlSheet = Nothing
End
errorhandler:
MsgBox Err.Description
End
As i say this works great on my windows xp system, but not on my windows 98 system, neither anyof the other 98 system i have tried.
Each time i am referencing the Excel9.olb in the vb program but this does not seem to change anything.
The line it points to is the line with .cell(1,1).
Error message -2147417848 which means "The object invoked has disconnected from its clients".
Thanks in advance
-
Jan 20th, 2002, 03:32 PM
#2
Thread Starter
New Member
I have managed to resolve this matter.
When i packaged the files ready for disturbution i found that the installer iwas using made a default reference to the excel9.olb to be installed on the host machine.
You must disable it such that the file is not distrubuted and this for some reason seems to correct the problem.
-out-
-
Jan 23rd, 2002, 08:26 AM
#3
Frenzied Member
Thats because VB uses different reference libraries for Excel 97 and Excel 2000.
Excel 200 uses version 9.0 and I think Excel 97 uses version 5.0.
-
Feb 25th, 2002, 12:37 PM
#4
New Member
excel olb
i think that you will find Excel 97 uses excel8.olb not 5 as mentioned previously
certainly excel9 from Excel2000/2002 will not work with earlier versions of excel
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
|