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

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!
 
B

Brent

It must be some setting i have somewhere.. because if i do:

imports microsoft.office.interop

it all works..

hmmm
 
C

Codemonkey

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top