Hello Baffled,
Both the Selection and Page objects have Export methods, so you could select
the shapes you want to export or export all of the shapes on the page or add
another bounding shape that effectively forces the area that's exported to a
specific size.
Have a go with the code below, which you can hopefully adapt to suit your
purpose.
Private Sub ExportAsImage()
'Assumptions are that the bounding box is larger
'than the area of the shapes to export and that
'no shapes sit outside of this area.
Dim sFileName As String
Dim sFileExt As String
Dim sFilePath As String
Dim pag As Page
Dim dblWidth As Double
Dim dblHeight As Double
Dim dblLeftX As Double
Dim dblLeftY As Double
Dim shpBoundingBox As Shape
'Set file strings
sFileName = "MyPngFileName"
sFileExt = ".png"
sFilePath = "C:\Documents and Settings\All Users\Desktop\"
'Get the active page
Set pag = ActivePage
'Set export size in inches
dblWidth = 3
dblHeight = 4
'Set bottom left hand corner of bounding box coordinates
dblLeftX = (pag.PageSheet.CellsU("PageWidth").Result(visInches) _
- dblWidth) / 2
dblLeftY = (pag.PageSheet.CellsU("PageHeight").Result(visInches) _
- dblHeight) / 2
'Draw a bounding box that determines the output image size
Set shpBoundingBox = pag.DrawRectangle(dblLeftX, dblLeftY, _
dblLeftX + dblWidth, dblLeftY + dblHeight)
shpBoundingBox.SendToBack
pag.Export (sFilePath & sFileName & sFileExt)
End Sub
Hope that helps.
Best regards
John
John Goldsmith
www.visualSignals.co.uk