Editing a Visio object in Excel (text field)

naveed

New Member
Joined
Oct 13, 2006
Messages
7
Hello, I have spent the better half of today looking for a way to do this, but my programming isn't strong enough to grind through it.

I have built a small structure in Visio, It is one of the 20 or so different symbols I may need to use. My problem is not selecting which one from the template sheet, but editing the "PRS" text field via an excel macro.

prssy9.png


I am fairly new to VB and macros in Excel, most of what I have done has been self taught from using the macro recorder and learning what I can. However macro recorder can get me to the point where the visio image in excel is open for editing, but as far as picking that field and changing it from PRS to whatever the label has to be I have not been able to figure out. Here is what I have for In Excel -

Code:
Sub Macro1()
    ActiveSheet.Shapes("PRS").Select
    Selection.Verb Verb:=xlPrimary
End Sub

And taking the object in Visio and using its macro recorder when doing the same thing got me this code (changing the PRS to be PRS2)

Code:
Sub Macro3()
    Dim vsoCharacters1 As Visio.Characters
    Set vsoCharacters1 = Application.ActiveWindow.Page.Shapes.ItemFromID(13).Characters
    vsoCharacters1.Begin = 0
    vsoCharacters1.End = 3
    vsoCharacters1.Text = "PRS2"
End Sub

I cannot use this code in the Excel VB because I get errors (presumably from the visio commands not being recognized).

In the VB editor, I checked Tools -> References, and there are 5 or 6 Visio related references there, I am unsure which if any could help me in this situation, and Don't really know what each does (looked online for documentation, didn't find much)

I am also assuming that because in Visio's code, I referenced that field through ItemFromID(13).Characters that this item ID does not translate over to Excel.

So that is my basic question, I do not know how to access that PRS field in excel using a macro. The goal is to be able to make copies of that visio structure, and label them as needed for different data lists.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,215,734
Messages
6,126,543
Members
449,316
Latest member
sravya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top