Because Draw serves up the wrong thumbnail in Windows Explorer* I need a macro to set the page size to all objects in the document .
Google found me some in here and I tried them but each one puts the page offset from 0,0 bottom left, even this one from Sub GDG_John( ) Option ExplicitSub fitCanvas() Dim s As Shape Dim w As Double, h As Double Set s = ActiveSelection If s.Shapes.Count = 0 Then MsgBox "Please make a selection" Exit Sub End If s.GetSize w, h ActivePage.SizeHeight = h ActivePage.SizeWidth = w ActiveDocument.ReferencePoint = cdrBottomLeft s.SetPosition 0, 0End SubSo anyone any ideas how I can make this work correctly so that the page correctly encompasses all objects? Ideally I don't want to SelectAll first either.TIA* I argued the toss about this on many occasions whilst I was a beta tester but got nowhere. CorelDraw stores two thumbnails minimum, one for Page1 and one called Thumbnail. For each extra page you get an additional thumbnail. In explorer the default is Page1 thumbnail which only shows what it on the page whereas Thumbnail displays all objects on the desktop. I couldn't give a fig about the page contents for drawings that are drawn at actual life size, but there is no way of making Draw serve up the Thumbnail.jpg. I argued that if the page border was not on display then the all objects thumbnail should be shown.
This is what the macro created, as you can see the page is offset below 0,0 and slightly to the right.
Sub SetPageSize()Dim sr As ShapeRange, s As ShapeDim x#, y#, w#, h#, guid As ShapeRangeActiveDocument.BeginCommandGroup ("pagesize")ActiveDocument.Unit = cdrMillimeterSet sr = ActivePage.Shapes.AllIf sr.Count = 0 Then Exit SubSet guid = ActivePage.FindShapes(Type:=cdrGuidelineShape)sr.RemoveRange guidsr.GetBoundingBox x, y, w, hActivePage.SetSize w, hsr.AlignRangeToPageCenter (cdrAlignVCenter)ActiveDocument.EndCommandGroupEnd Sub
hywelharris said:I need a macro to set the page size to all objects in the document .
If you haven't already done so, you might try my Fit Page to Content macro.
Unfortunately that creates a page the right size, but in the wrong place and then moves all the content to the page and off the lovingly created guidelines!
hywelharris said:Unfortunately that creates a page the right size, but in the wrong place and then moves all the content to the page and off the lovingly created guidelines!
The challenge here is that the CorelDRAW page cannot be defined at an arbitrary location within the 1800 x 1800 inch CorelDRAW "world". The page is always centered in that world.
My macro tries to move EVERYTHING - including guidelines, hidden objects, locked objects, objects on locked and/or hidden layers, etc. so that nothing is messed up.
It has an option to allow master layers to be ignored.