Ladies and gentlemen,
I have a VB.NET program which launches Visio 2010 and draws a diagram representing the problem which the VB.NET program solves. It works just fine when I run the program in Visual studio. But when I deploy the program, I get an error.
I added the reference Microsoft.Office.Interop.Visio
I do not have any imports
Here is my code:
Dim VisioApp As New Microsoft.Office.Interop.Visio.Application Dim ShapeObj, ShapeObj2 As Microsoft.Office.Interop.Visio.Shape ' Visio.Shape Dim vsoCell1 As Microsoft.Office.Interop.Visio.Cell ' Visio.Cell Dim vsoCell2 As Microsoft.Office.Interop.Visio.Cell ' Visio.Cell Dim MasterDoc As Object VisioApp.Visible = True VisioApp.Documents.Open(DatabaseFileDirectory & "\" & "Template1.vsd") Dim VisioMaster As Microsoft.Office.Interop.Visio.Master MasterDoc = VisioApp.Documents("Steam.vss") MsgBox("After Master doc") VisioApp.Window.Application.Windows.ItemEx("Template1").Activate() ' This is the line causing the problem MsgBox("After Activating Template")
I do get the message "After Master Doc". I do not get the message "After Activating Template", thus, the line causing the error is
VisioApp.Window.Application.Windows.ItemEx("Template1").Activate()
I changed the line to
VisioApp.Window.Application.Windows.Item(1).Activate()
but I got the same problem. I works fine when I run it in visual studio, but the deployed program still gives an error.
Can I get some help please?