VSTO 2008 ambiguous name

Hi
I am getting an error on the following line of code "Globals is ambiguous, imported from the namespaces or types AOG2.Microsoft.Visual Basic.

xlApp.ActiveWorkbook.Styles.Merge(Workbook:=xlApp.Workbooks(Globals.ThisWorkbook.Name))
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
 
PaulHewsCommented:
The message means that the keyword "Globals" could refer to more than one class or namespace.  It sounds like you have an Imports statement for the Microsoft.VisualBasic namespace.  If you remove that Imports statement, it should fix your Globals reference.  If you are using functions from the MS.VisualBasic namespace, you would have to fully qualify them in your code.

Example, instead of calling "Instr" you would have to call Microsoft.VisualBasic.Instr
0
 
Rory ArchibaldCommented:
What kind of project is this and what references do you have set?
Regards,
Rory
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Hi

Its a managed spreadsheet project. I had moved it from a computer with VS 2008 and Office 2003 to a machine with Office 2007
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.