Using Page.Export via macro can you set rotate orientation

S

Steve

The following code exports each of my tabs as PNG files for inclusion in a
document.
(Just like save as then selecting PNG file as file type|)

Dim mPage As Page
For Each mPage In Application.ActiveDocument.Pages
mPage.Export "C:\PicturesForDoc\" & mPage.Name & ".png"
Next

This works but orientation can be set on export dialog, but is not a
function of Export method.
Is there a way to set this via vba?
 
S

SteveM

The following code exports each of my tabs as PNG files for inclusion in a
document.
(Just like save as then selecting PNG file as file type|)

Dim mPage As Page
For Each mPage In Application.ActiveDocument.Pages
    mPage.Export "C:\PicturesForDoc\" & mPage.Name & ".png"
Next

This works but orientation can be set on export dialog, but is not a
function of Export method.
Is there a way to set this via vba?

I'm not the expert. But it looks like you can't.

Would a possible (inelegant) work around be to record a macro that
follows this menu sequence?:

Edit -> Select All -> Shapes -> Rotate or Flip -> Rotate Left

Then do the export and repeat the above but Rotating Right.

You could mod the Selection statements for required customization.

BTW, sandwich the code with Application.ScreenUpdating = False then
True

SteveM
 
J

JuneTheSecond

Hi, Steve

Try Visio 2010 Beta.
It has many options for export.
This is one of the recorded macros.

Sub Macro1()

'Enable diagram services
Dim DiagramServices As Integer
DiagramServices = ActiveDocument.DiagramServicesEnabled
ActiveDocument.DiagramServicesEnabled = visServiceVersion140

Application.Settings.SetRasterExportResolution
visRasterUseScreenResolution, 96#, 96#, visRasterPixelsPerInch
Application.Settings.SetRasterExportSize visRasterFitToSourceSize, 3.75,
1.1875, visRasterInch
Application.Settings.RasterExportDataFormat = visRasterInterlace
Application.Settings.RasterExportColorFormat = visRaster24Bit
Application.Settings.RasterExportRotation = visRasterRotateLeft
Application.Settings.RasterExportFlip = visRasterNoFlip
Application.Settings.RasterExportBackgroundColor = 16777215
Application.Settings.RasterExportTransparencyColor = 16777215
Application.Settings.RasterExportUseTransparencyColor = False
Application.ActiveWindow.Page.Export "E:\Users\yoda\Desktop\test.png"

Application.Window.WindowState = visWSMinimized
Application.Window.WindowState = visWSRestored

Application.ActiveDocument.SaveAsEx "E:\Users\yoda\Desktop\test.vsd",
visSaveAsListInMRU

Application.ActiveDocument.SaveAsEx
"E:\Users\yoda\Documents\Visio図é¢\Export Options in Visio2010.vsd",
visSaveAsWS + visSaveAsListInMRU
End Sub

--
Best Regards.

JuneTheSecond
Now, visual calculation is more visual.
http://www.geocities.jp/visualcalculation/english/index.html
 
A

AlEdlund

Very nice example(s)!
al


JuneTheSecond said:
Hi, Steve

Try Visio 2010 Beta.
It has many options for export.
This is one of the recorded macros.

Sub Macro1()

'Enable diagram services
Dim DiagramServices As Integer
DiagramServices = ActiveDocument.DiagramServicesEnabled
ActiveDocument.DiagramServicesEnabled = visServiceVersion140

Application.Settings.SetRasterExportResolution
visRasterUseScreenResolution, 96#, 96#, visRasterPixelsPerInch
Application.Settings.SetRasterExportSize visRasterFitToSourceSize,
3.75,
1.1875, visRasterInch
Application.Settings.RasterExportDataFormat = visRasterInterlace
Application.Settings.RasterExportColorFormat = visRaster24Bit
Application.Settings.RasterExportRotation = visRasterRotateLeft
Application.Settings.RasterExportFlip = visRasterNoFlip
Application.Settings.RasterExportBackgroundColor = 16777215
Application.Settings.RasterExportTransparencyColor = 16777215
Application.Settings.RasterExportUseTransparencyColor = False
Application.ActiveWindow.Page.Export "E:\Users\yoda\Desktop\test.png"

Application.Window.WindowState = visWSMinimized
Application.Window.WindowState = visWSRestored

Application.ActiveDocument.SaveAsEx "E:\Users\yoda\Desktop\test.vsd",
visSaveAsListInMRU

Application.ActiveDocument.SaveAsEx
"E:\Users\yoda\Documents\Visio図é¢\Export Options in Visio2010.vsd",
visSaveAsWS + visSaveAsListInMRU
End Sub

--
Best Regards.

JuneTheSecond
Now, visual calculation is more visual.
http://www.geocities.jp/visualcalculation/english/index.html
 

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