Quantcast
Channel: CorelDRAW Community
Viewing all articles
Browse latest Browse all 7339

VBA Bug in X6: Shape.AlignToPage does not work

$
0
0

Hi.

Please test and fix before Update 3.

VBA Bug in X6: Shape.AlignToPage does not work

 

A person asked me a question and supplied this simple code. I can verify that align to page does not work in X6. Also upon subsequent runs of the code I could not get the page size to change with the SetSize method.

Sub PageSize()

Dim W As Double
Dim H As Double

Dim W2 As Double
Dim H2 As Double

Dim OB As Shape

Set OB = ActiveShape
If OB Is Nothing Then
MsgBox "Please Select an object", vbExclamation, "Error"
End
End If
W = ActiveSelection.SizeWidth / 10
H = ActiveSelection.SizeHeight / 10

W2 = ActiveSelection.SizeWidth + ((W + H) / 10)
H2 = ActiveSelection.SizeHeight + ((W + H) / 10)

ActivePage.SetSize W2#, H2#

If VersionMajor < 16 Then
    If ActiveSelection.Shapes.Count = 1 Then
    ActiveSelection.AlignToPage cdrAlignHCenter, cdrTextAlignBoundingBox
    ActiveSelection.AlignToPage cdrAlignVCenter, cdrTextAlignBoundingBox
    Else
    ActiveSelection.Group
    ActiveSelection.AlignToPage cdrAlignHCenter, cdrTextAlignBoundingBox
    ActiveSelection.AlignToPage cdrAlignVCenter, cdrTextAlignBoundingBox
    ActiveSelection.Ungroup
    End If
Else
    ActiveSelection
   
End If

 

~John


Viewing all articles
Browse latest Browse all 7339

Trending Articles