Automate Best Fit to Page (Org Charts)

C

Casey

I'm using Visio 2003 to generate org charts and I was wondering if
there was a way to run the "Best Fit to Page" command found under the
org chart menu from vba?

THANKS,
Casey
 
C

Casey

Nevermind I found it. For those interested with Visio 2003 (and maybe
2002), the command is:

RUNADDONWARGS("OrgC11","/cmd=fittopage")

-Casey
 
C

Casey

Nevermind I found it. For those interested with Visio 2003 (and maybe
2002), the command is:

RUNADDONWARGS("OrgC11","/cmd=fittopage")

-Casey

Now I'm trying to run this command for every page in the active
document. I setup a For..Next loop, however, Visio seems to go on to
the next page before the addon finishes running. The addon only seems
to run for the page I'm actually on, not for every page in the
document. Here's my code, I was thinking maybe I should add a timer
to make Visio wait a certain length of time before moving on. Any
ideas?


'Code to make each page best fit
Dim vispage As Visio.Page

For Each vispage In ActiveDocument.Pages

Visio.Addons("OrgC11").Run ("/cmd=fittopage")

Next vispage
 
H

Hadriel

Not sure if this will help, but you don't have to do it as an addon - use the
ResizeToFitContents method of the page object. (won't work in anything
ealier than Visio 2002 though) Otherwise, maybe try setting
application.screenupdating to 0 to reduce the time? (or even
application.showchanges) but that may break it... one way to find out. :)
-hadriel
 

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

Similar Threads


Top