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.
Printable View
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.
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
Don't forget to set your project to use the excel library in the references.
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.
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
shell "c:\prorgam files\exel\the application.exe"