![]() |
#1
|
|||
|
|||
![]()
Hi,
I'm using Corel Draw X4. I have automated the manipulation of a CDR template out of MS Access and seem to be having a timing issue on one computer, but not others. Here is the code: Quote:
When this code executes, I get the following error message: "-2147024809: Layer "Graphics" not found" The Graphics layer is definitely there, because, as I mentioned, this works perfectly on a different computer. So, I commented out the 'Layer.Activate' line and tried again. This time I got a different error message: "-2147467259: The specified object is not found" This error occurs on the 3rd from last line of code in the sample. The "ColorText(i, 1)" code is simply reading the shape name from an array. The interesting thing is, if I put a breakpoint at either of these lines of code and then click the Run button in the Access debugger, everything works fine. This leads me to think that I have a timing issue. For example, maybe Corel Draw isn't ready for my code execution because its still busy sorting itself out after creating the document from a template. So, I declared the kernel sleep API and added a 5 second delay after creating the new document. Sadly, still no joy. ![]() Does anyone have any clues for me?? Thanks in advance, George |
#2
|
|||
|
|||
![]()
Hi,
Try multiple Sleep() calls in a loop with a DoEvents alongside each. Just calling Sleep() does not let VBA finishing anything it still needs to do. -James |
#3
|
|||
|
|||
![]()
Thanks James. I'll give that a try on Monday and report back.
George |
#4
|
|||
|
|||
![]()
I always check for the state of the Corel Window via API, using FindWindow, IsIconic, IsVisble and adjust accordingly. This one got me, because the class name changed for the first time ever since v1.0 in the X5 service pack 1, so I now check for them with possible future SP's...
Code:
For i = 4 to 0 Step-1 hwCorel = FindWindow("CorelDRAW 15." & Cstr(i), vbNullString) If hwCorel <> 0 Then If IsIconic(hwCorel) Then ShowWindow(hwCorel, SW_NORMAL) Exit For End If Next i Last edited by shelbym; 18-08-2010 at 16:46. Reason: Fixed Code Tag |
#5
|
|||
|
|||
![]()
James,
I gave your idea a try but still no joy. I'm going to get time to experiment a bit more with it on Sunday, probably trying even longer delays. But I feel that there is something else involved here. I'll add another post after Sunday. George Last edited by gag546112; 21-08-2010 at 09:07. |
#6
|
|||
|
|||
![]()
SteveDude,
Thanks for this suggestion. I'll give this a try on Sunday as well. Can I take it that the Corel Draw window has to be visible in order for the VBA code running in MS Access to be executable? Regards, George |
#7
|
|||
|
|||
![]()
Now I feel a bit embarrassed!!
I inadvertently put the time delay before the "oApp.Visible = True" statement, instead of after it. Once I fixed that, I found that a one second delay was sufficient to allow the Corel Draw X4 window to appear. Everything now working great. Thanks for your suggestions. Its good to know that there are folks like the two of you out there to offer us novices assistance when we need it. George |
#8
|
|||
|
|||
![]()
Hi George,
It has happened to all of us. I am glad that you are able to move forward with your project. -James |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
PMS color - X5 Issue | biok | CorelDRAW/Corel DESIGNER VBA | 4 | 29-04-2010 13:52 |
Eraser issue | jahmer | General | 0 | 17-01-2008 15:59 |
SetSize issue | Dave Rowland | CorelDRAW/Corel DESIGNER VBA | 3 | 11-01-2008 16:36 |
weird font issue | bbolte | CorelDRAW/Corel DESIGNER VBA | 1 | 21-04-2005 15:20 |
Thumbnailer Issue with EPS files | vallentin | Macros/Add-ons | 2 | 16-03-2004 10:04 |