OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-11-2009, 21:25
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default Draw 12 Setting guides exactly

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!
Reply With Quote
  #2  
Old 04-11-2009, 22:16
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,787
Blog Entries: 11
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Integer

Because
Code:
Dim n As Integer
An Integer is a Whole number, you should use Double instead.

-Shelby
Reply With Quote
  #3  
Old 04-11-2009, 22:18
knowbodynow knowbodynow is offline
Senior Member
 
Join Date: Mar 2006
Location: Hatsukaichi near Hiroshima
Posts: 434
Default

Thanks, Shelby, I completely missed that!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Crops marks Setting in Corel Draw X3 ubrbilly General 1 17-04-2009 08:06
Change Import setting Wynprice General 4 07-10-2007 11:52
Setting Printable Layers knowbodynow CorelDRAW/Corel DESIGNER VBA 2 13-04-2006 08:38
Delete All Guides shelbym CorelDRAW/Corel DESIGNER VBA 3 22-10-2004 17:36
Setting Outline Color AC CorelDRAW/Corel DESIGNER VBA 1 18-03-2003 18:33


All times are GMT -5. The time now is 18:55.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com