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 12-03-2007, 06:25
Webster
Guest
 
Posts: n/a
Default Why does this code run so slow?

Public Sub GetSize()

Dim SzX As Double
Dim SzY As Double
Dim XStr As String
Dim Ystr As String
Dim x As Double
Dim y As Double
Dim Shift As Long
Dim b As Boolean
Dim s As Shape

ActiveDocument.Unit = cdrMillimeter

If ActiveSelectionRange.Count = 0 Then
MsgBox "There doesn't appear to be any objects selected.", vbOKOnly, "Dimensions"
Exit Sub
End If

SzX = ActiveSelection.SizeWidth
SzY = ActiveSelection.SizeHeight

XStr = FormatNumber(SzX, 2)
Ystr = FormatNumber(SzY, 2)

b = False

While Not b
b = ActiveDocument.GetUserClick(x, y, Shift, 10, False, cdrCursorEyeDrop)
If Not b Then

Set s = ActiveLayer.CreateArtisticText(x, y, XStr & "mm x " & Ystr & "mm")
b = True
End If

Wend

End Sub



'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

On some machines in can take as long as a minute to run, though on most it will take 10 or 15 seconds for the curser to change to the eye dropper. However, once it has run, susequent executions will see it run instantly, as expected.

What am I doing wrong?
Reply With Quote
  #2  
Old 12-03-2007, 09:18
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
 
Join Date: Mar 2005
Posts: 836
Default

First thing that comes - delete recent font list kept here: c:\Documents and Settings\**yourAccount**\Application Data\Corel\Graphics13\User Draw\FontListMRU.xml - similar folders for corel11/12

Or maybe too many fonts installed?
or some fonts referenced in registry that don't exist?
or you have a font refernce in font list that points to a fontfile on networked computer? if so immediately copy it to your pc and never do such remote installations :-)
Reply With Quote
  #3  
Old 13-03-2007, 07:35
ddonnahoe's Avatar
ddonnahoe ddonnahoe is offline
Senior Member
 
Join Date: Jan 2004
Location: Louisville, KY
Posts: 552
Send a message via ICQ to ddonnahoe Send a message via AIM to ddonnahoe Send a message via MSN to ddonnahoe Send a message via Yahoo to ddonnahoe
Default

Another thought is, you could have Delay Load VBA set to True in the options dialog. Go to Tool>Options>Workspace>VBA.
__________________
Sean
Waiting for a ride in the T.A.R.D.I.S.
Reply With Quote
  #4  
Old 20-03-2007, 05:18
Webster
Guest
 
Posts: n/a
Default

Thanks.

I don't think it is a font issue, because this...........

Option Explicit
Public SzX As Double
Public SzY As Double

Public Sub SmSz()
ActiveDocument.Unit = cdrMillimeter
If ActiveSelectionRange.Count = 0 Then
MsgBox "There doesn't appear to be any objects selected.", vbOKOnly, "Make Same Size"
Exit Sub
End If

SzX = ActiveSelection.SizeWidth
SzY = ActiveSelection.SizeHeight

Frm2ndObj.show (0)
End Sub

Private Sub CmdRun_Click()
ActiveShape.SetSize SzX, SzY
Frm2ndObj.Hide

End Sub

.............................................

exhibits the same issue. For some reason, it seems to relate to the testing of the selections X,Y size.

Got me baffled.

It only happens the first time the code is run. Other VBA code works fine first time every time.
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
Simple Bar code generator Webster Code Critique 2 06-09-2010 01:41
HOW-TO call coreldraw12 find dialog from VBA code???? wOxxOm CorelDRAW/Corel DESIGNER VBA 4 02-03-2008 08:32
CDR12: TTF Font exporting - specify character code zlatev CorelDRAW/Corel DESIGNER VBA 0 03-12-2005 05:54
Text ENCODE Craig Tucker CorelDRAW/Corel DESIGNER VBA 10 26-01-2005 13:59
How to use events from CorelDRAW.Document in my code? me CorelDRAW/Corel DESIGNER VBA 2 30-10-2004 02:49


All times are GMT -5. The time now is 07:34.


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