Earlier post about excel.. Still not working.. Guru needed!

  • Thread starter Thread starter Brent
  • Start date Start date
B

Brent

Ok this is driving me nuts.. I add a com reference to the excel 11.0
library

and throw this in

Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
Dim oSheet As Excel.Worksheet
Dim oRng As Excel.Range

From the microsoft example for automating with excel. It somehow refuses to
recognize that I did a reference. This has been happening ever since i had
to reload. I've done excel stuff before, no problems..

It underlines excel.application, excel.workbook, etc etc all as undefined. I
know how to add a com reference, its there.. I have no idea whats going on
:( help!
 
It must be some setting i have somewhere.. because if i do:

imports microsoft.office.interop

it all works..

hmmm
 
Brent,

From the sounds of what you are describing, you need to have the Imports
statement at the top of each file to resolve the namespace.

To avoid doing this in every file, go to the Properties of the project and
then go to the Imports Section. You can add a global project import for the
microsoft.office.interop namespace.

Have a look at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vaconnamespaces.asp
if you are unsure of how namespaces work.

HTH,

Trev.
 
Back
Top