Visio Guy

Visio Discussions => Programming & Code => Topic started by: jzdesoucey on September 30, 2019, 09:39:18 PM

Title: vsoShape1.text in VB forces alignment
Post by: jzdesoucey on September 30, 2019, 09:39:18 PM
Trying to use an old module to populate a drawing with multiple objects from a *.prn file.
When I get to the vsoShape1.text line in the code the drawing forces me to align or cancel.
How can I get this to stop or take advantage of it? There are nearly 100 objects to be created.

Code Example Follows:

***"If Field1 = "Vnet" Then
Set vsoMaster = Visio.Documents.Item("CnE_CloudV2.7.vss").Masters.ItemU("Virtual Network")
Set vsoShape1 = ActivePage.Drop(vsoMaster, dblx, dbly)
vsoShape1.Text = Field2
vsoShape1.Name = Field2"***

    Else
Title: Re: vsoShape1.text in VB forces alignment
Post by: Yacine on October 01, 2019, 06:19:44 AM
Check the validity of Field2.
eg: if not field2 is nothing then...

bad practice but possible:
enclose the critical code between "on error resume next" and "on error goto 0"