Click to See Complete Forum and Search --> : why does this not work for me?
coolily
January 4th, 2000, 02:39 PM
i want to access excel from a form in vb for which i declared
Public anyvariable As Excel.Application
this does not seem to work.
what can i do to access excel data from a vb form. help please.
Chris Eastwood
January 4th, 2000, 02:46 PM
Have you remembered to set a reference to the 'Microsoft Excel x Object Library' ?
I'm using Excel 2000 and this code works :
Dim o as Excel.Application
'
set o = new Excel.Application
MsgBox o.OperatingSystem
'
You can test this without having to set a reference :
Dim o2 as Object
'
set o2 = CreateObject("Excel.Application")
MsgBox o2.OperatingSystem
'
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
wilton
January 4th, 2000, 04:34 PM
Don't forget to set your project to use the excel library in the references.
coolily
January 5th, 2000, 01:20 PM
i am sorry to bother you but i seem to get this error
'
user defined type not defined
'
i dont know how to set the reference to the 'Microsoft Excel x Object Library' too
I'm using Excel 97 and vb does not seem to recognise excel at all. when i try to access
excel from visual data manager, it says that
driver is not recognised. what can possibly be wrong.
Chris Eastwood
January 5th, 2000, 03:19 PM
From VB, go to the 'Project', then choose 'References' (it may take a while) - then look for 'Microsoft Excel x Object Library' (where x is the version of Excel on your machine).
The code samples posted here should then compile. You can always try the other method I posted (ie. Dim xxx As Object) without setting any references.
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
Anchor Blue
January 5th, 2000, 05:39 PM
shell "c:\prorgam files\exel\the application.exe"
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.