News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Visio 2010's New VBA Options for exporting as images

Started by JuneTheSecond, March 03, 2010, 06:23:30 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JuneTheSecond

Visio 2010 Beta has many new options for exporting drawing as images,
such as jpg, png, etc.
You can record the operation to save drawing as iamages.
I've tried to save a drawing as jpg with 600 dpi and rotated 90 degrees.
This is an example macro.



Sub Macro4()

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

   Application.Settings.SetRasterExportResolution visRasterUsePrinterResolution, 600#, 600#, visRasterPixelsPerInch
   Application.Settings.SetRasterExportSize visRasterFitToPrinterSize, 1.133333, 1.511667, visRasterInch
   Application.Settings.RasterExportColorFormat = visRasterRGB
   Application.Settings.RasterExportOperation = visRasterBaseline
   Application.Settings.RasterExportRotation = visRasterRotateRight
   Application.Settings.RasterExportFlip = visRasterNoFlip
   Application.Settings.RasterExportBackgroundColor = 16777215
   Application.Settings.RasterExportQuality = 100
   Application.ActiveWindow.Page.Export "E:\Users\yoda\Desktop\Export Options in Visio2010.jpg"

   'Restore diagram services
   ActiveDocument.DiagramServicesEnabled = DiagramServices

End Sub



Best Regards,

Junichi Yoda
http://june.minibird.jp/


kedas

Hi,

Although they added these extra parameters in Visio 2010 for VBA (it was already present in GUI) if you plan to use the exported image/drawing in word I advice to export to .emz format. I also use Visio 2007 so I don't had these resolutions settings in VBA, if you use .emz you don't have to care about how to reduce quality, it's vector based just like Visio you can resize in word without any quality loss.


Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 180 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1055KB.
Tokens: post-login.
Cache hits: 13: 0.00148s for 26,748 bytes (show)
Cache misses: 2: (show)
Queries used: 16.

[Show Queries]