I have this code:
Code:
Sub addguides()
Dim D As Document
Dim p As PageSize
Dim x As Long, y As Long
Dim l As String
Dim n As Integer
ActiveDocument.Unit = cdrMillimeter
n = 3.2
'------------------------ Undo Group Start ------------------------
ActiveDocument.BeginCommandGroup "Undo action description"
Optimization = True
EventsEnabled = False
ActiveDocument.SaveSettings
ActiveDocument.PreserveSelection = False
l = ActiveLayer.Name
x = ActivePage.SizeWidth - n
y = ActivePage.SizeHeight - n
ActivePage.Layers("Guides").CreateGuideAngle x, y, 0 ' Horizontal
ActivePage.Layers("Guides").CreateGuideAngle x, y, 90 ' Vertical
x = ActivePage.SizeWidth - ActivePage.SizeWidth + n
y = ActivePage.SizeHeight - ActivePage.SizeHeight + n
ActivePage.Layers("Guides").CreateGuideAngle x, y, 0 ' Horizontal
ActivePage.Layers("Guides").CreateGuideAngle x, y, 90 ' Vertical
ActiveDocument.RestoreSettings
EventsEnabled = True
Optimization = False
Application.Refresh
ActiveWindow.Refresh
ActiveDocument.EndCommandGroup
'------------------------ Undo Group End ------------------------
ActiveDocument.ClearSelection
ActivePage.Layers(l).Activate
End Sub
But the guides are being placed at 3mm from the document edge - why is 3.2 being rounded down to 3. Thanks!