Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vba in visio causes error when linked in word

Status
Not open for further replies.

xplo5iv

Technical User
Jan 5, 2005
75
GB
Hi

I've created a Visio document which runs a sub when opened...
Code:
ThisDocument.Pages.Item(1).Shapes.ItemFromID(4).Characters.Text = Left(ActiveDocument.Name, Len(ActiveDocument.Name) - 4)
This works fine, but if I then link the Visio diagram into Word I get an error when trying to update. I know it must be due to the vba referencing, but I hardly know Visio vba and I'm stuck.

TIA

Jonathan
 
Oops, sorry!

Run time error 91

Object variable or with block variable not set

Thx

Jonathan
 
That is all the code at the minute, other than the bit automatically filled in by Visio ie

Code:
Private Sub Document_DocumentOpened(ByVal doc As IVDocument)

ThisDocument.Pages.Item(1).Shapes.ItemFromID(4).Characters.Text = Left(ActiveDocument.Name, Len(ActiveDocument.Name) - 4)

End Sub

Thx

Jonathan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top