In visio click View -> Macros. Type the name of the macro (I called mine saveallpages) and click the Create button. The code should look like this.
Public Sub saveallpages() Dim i As Integer Dim formatExtension As String formatExtension = ".jpg" '// Init folder, doc and counter: folder = ThisDocument.Path Set doc = Visio.ActiveDocument i = 1 '// Loop through pages: For Each pg In doc.Pages '// Setup the filename: FileName = Format(i, "000") & " " & pg.Name '// Append '(bkgnd)' to background pages: If (pg.Background) Then FileName = FileName & " (bkgnd)" '// Add the extension: FileName = FileName & formatExtension '// Save it: Call pg.Export(folder & FileName) i = i + 1 Next End Sub
Tx man, but doesn't work for me. In the debugger, the following line is highlighted:
ReplyDelete"Call pg.Export(folder & FileName)"
Any idea what i should do to fix?
Thanks again
Ido
Hmm not sure it's just something that I needed at the time. My guess is that the folder variable comes from ThisDocument.Path. Maybe if you don't have a visio open or its on a network path it won't work.
ReplyDeleteTry this:
Copy the visio diagram to your desktop.
Make sure to open the visio diagram from your desktop
Now go to view -> marcros
Type the name of the macro "saveallpages" and click the create button
Delete what ever code is there by default
Copy paste my code in
Run it
The jpgs will be created on your desktop (where the visio diagram that you have open is located)
This is so great. Can you help me customize this to save in a new folder on the desktop and save with only the filename on the tabs and not include the 001? I am not a code person but this may be the answer to all of my questions. Thanks,Denise
ReplyDeleteThank you...If I haven't seen this blog, I could have gone through the tedious process in saving 100+ sheets :)
ReplyDeleteWhat a great help! cant believe the latest version still cant do this with out a macro, thanks for posting this.
ReplyDeleteWas looking everywhere for a solution to this and yours worked very well thanks! I tweaked it a bit to just say "Slide - " rather than the slide number. Thanks again as i had a huge number of slides to save and doing them one by one was not an option!
ReplyDelete