Error on name page in vba

T

trungminator

Hi,

When I record a new macro and then I click on a page name "1.1", in the
vba code window, it's shows :
Application.ActiveWindow.Page =
Application.ActiveDocument.Pages.ItemU("Page 2.2").
It means that my page name is wrong but in my label, it's written "1.1"
so it's right. It seems that there is a label for the page that i don't
see that is different from the one on the visio page.

Where can i find this label to change it so "1.1" and "1.2" can be both
"1.1" so my vba code can work?

Thanks
 
P

Paul Herber

Hi,

When I record a new macro and then I click on a page name "1.1", in the
vba code window, it's shows :
Application.ActiveWindow.Page =
Application.ActiveDocument.Pages.ItemU("Page 2.2").
It means that my page name is wrong but in my label, it's written "1.1"
so it's right. It seems that there is a label for the page that i don't
see that is different from the one on the visio page.

Where can i find this label to change it so "1.1" and "1.2" can be both
"1.1" so my vba code can work?

Many items in Visio have what are called Universal and local names.
When an item is first named the universal and local name are both the
same, when an item gets renamed manually then only then local name
changes.
Your ItemU code above is accessing the universal name, change it to
Item and it should work.

If you write a loop
for page = 1 to activeDocument.pages.count
print activeDocumemt.pages.Item[page].name
print activeDocumemt.pages.Item[page].nameU
end
you will see the different names.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top