Reorder pages from VBA

Started by zhuravsky, October 13, 2023, 09:55:24 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zhuravsky

Too big files, I'll need some time to compress them.

wapperdude

#16
Danger Will Robinson!   ???

I did some additional testing of the two algorithms.  The goal was to see if I could slow my six page document, page naming and / or break links between the pages. 
Well, 6 pages is not enough to time.  Period.  But I did make an interesting discovery. 

But 1st, background.   Each page has 1 or more shapes; all pages have a Sheet.1 shape.  Each shape has a 3 row user section.  Each shape has field inserted shape name text.  The 1st, active page, has a yellow shape that also has field inserted text, User.Row_1.  But what is shown, is actually some text in User.Row_3.  Ever watch those crime dramas where they try to trace a call, but the perpetrator bounces the signal all over the world?  That's what I did, User.Row_1 points another shape on another page which points to another shape on another page.  Some times back and forth to a page multiple times.  I thought that might slow things down, since, in renaming, Visio would have to correct every formula. 

Indeed it does...with my longer algorithm.

BUT, the formulas remain unaltered in the Nikolay short version.  This was unexpected.  The displayed result in the yellow shape is correct.
Haven't looked into this, just saying Beware!

EDIT:  Simple change corrects issue. 

For i = 1 To 2
  For Each p In ActiveDocument.Pages
    p.Name = Missing
    p.NameU = p.Name
  Next
Next


...and the Niko!ay simple code method is fixed, as good as new!
 
Visio 2019 Pro

Nikolay

#17
Thank you for checking!
I did not check if the formulas were modified properly. Looks like this "method" is not really working  :-\

@wapperdude I have added a warning to the post saying this "method" with = Missing does not seem to work properly.