Adding Visio COM items to Visual Basic
- Hi,
I am trying to create a visio flow chart with visual basic 2005 but I keep running into the same problem. I have added a reference to the Microsoft Visio type Library, but when I try to Declare a variable as a Visio.Application of Visio.Document I get an error "Visio.Application not defined" It seems as if adding the COM reference to the Visio Type Library has no effect. Is there some setup that I am missing?
Réponses
sunkinodaps,
According to your problem on adding Visio object library in .NET development, I would like to provide you the suggestions as follows:
1. Please provide the version information in your Visio. For Visio 2007, click Microsoft Visio 12.0 Type Library. For Visio 2003, click Microsoft Visio 11.0 Type Library. For Visio 2002, click Microsoft Visio 2002 Type Library.
2. In order to create the COM add-in, we will do the following:
- Create a COM add-in project called TutorialAddin.
-
Add a reference to the Visio Primary Interop Assembly (PIA).
-
Specify a namespace for the assembly.
-
Implement the IDTExtensibility2 interface.
-
Modify the information in AssemblyInfo.vb.
-
Modify the setup project to register the add-in.
For further information, please take a look at the following Lesson in MSDN:
Lesson 1: Visio COM Add-in Creation in Visual Basic .NET
3. There is an example on Visio in VB.NET development of KB article. This article demonstrates how to automate Visio using Visual Basic .NET.
Hope that can help you.
Toutes les réponses
sunkinodaps,
According to your problem on adding Visio object library in .NET development, I would like to provide you the suggestions as follows:
1. Please provide the version information in your Visio. For Visio 2007, click Microsoft Visio 12.0 Type Library. For Visio 2003, click Microsoft Visio 11.0 Type Library. For Visio 2002, click Microsoft Visio 2002 Type Library.
2. In order to create the COM add-in, we will do the following:
- Create a COM add-in project called TutorialAddin.
-
Add a reference to the Visio Primary Interop Assembly (PIA).
-
Specify a namespace for the assembly.
-
Implement the IDTExtensibility2 interface.
-
Modify the information in AssemblyInfo.vb.
-
Modify the setup project to register the add-in.
For further information, please take a look at the following Lesson in MSDN:
Lesson 1: Visio COM Add-in Creation in Visual Basic .NET
3. There is an example on Visio in VB.NET development of KB article. This article demonstrates how to automate Visio using Visual Basic .NET.
Hope that can help you.- Hello and thanks for the help,
I have Visio 2003 installed and as you suggest I had added the Microsoft Visio 11.0 Type Library. I was actually following the steps in the example you reccommend above, How to automate Visio with Visual Basic .NET
I followed all the steps in that example from start to finish, cutting and pasting the the code into the module. That is when I got the Not Defined error. I didn't think I needed to create the COM, I thought since the 11.0 Type Library was available from the add in window that it was available. Is that wrong? Have I just missed something in the install?
sunkinodaps,
How about to try other Office automation application such as Word, Excel? Is there any Not Defined error on the instances of Word automation?
I suggest you to begin the test from one or two defined instance for the objects of Visio, then add the other necessary instances in your code. This can help you make clear with the problem you have and find the exact mistake in the code.
Hope that can provide you some idea and good luck.
- Hello,
I have tried both Word and Excel and both owrk just fine. One odd thing, when I add the Component for Word or Excel my pc blinks when I click the add button and before returning to the Visual Studio project. When I click the add for the Visio Component the window closes and returns to the project as if nothing is applied. Is there a way to examine the component? Is the Compnent installed in a default library that i can check?
Thank You for your help Hi,
I have the exact same problem. Anything starting with Visio in that code example gives me Type is not defined error. I made sure to make the reference, and I also created a add-in for visio, nothing helps.
Regards,
Joel
- I got the same problem, have you guys resolved it yet?

