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 27-06-2003, 17:04
BobReed
Guest
 
Posts: n/a
Default Macro Call from VFP

Hi,
I'm running a Visual FoxPro (v.8) program that loads a CDR in Corel 11, changes some object colors, and saves it. Works great.
Now I want to save it as a JPEG and need to call it with a 'StructExportOptions' Structure, which VFP does not support. So, I wrote a Macro, stuck it in GlobalMacros and have tried to call it from the VFP program (BTW VFP is fully OLE compliant).

Here's the code:
oCRL11=CREATEOBJECT("coreldraw.application.11")
oODoc=oCRL11.Opendocument("W:\AR_SP2.cdr")
*
* do the color change thing
objSheet = oCRL11.ActiveDocument.ActivePage.Shapes.Item(strOName)
objSheet.Fill.UniformColor.RGBAssign (intRed,intGreen,intBlue)
*
* now comes the error:
oCrl11.Application.GMSManager.RunMacro("GlobalMacros","Module1.ExportAsJPEG")

I get the old 'OLE error code 0x80004005: Unspecified Error' error.

Anybody have any clues here???

Thanks in advance
Bob
Reply With Quote
  #2  
Old 10-07-2003, 18:52
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: Macro Call from VFP

First, why doesn't VFP support StructExportOptions?

Did you try it like this?

oStruct = oCRL11.CreateStructExportOptions

Second, does your macro have any parameters or return values? In other words, make sure you have all the parameters specified in call to GMSManager.RunMacro

Finally, macros are executed by VBA which is not loaded by default with CorelDRAW until you use some of VBA features in the UI. If you want to access any VBA functionality programmatically before VBA is loaded and initialized, it will fail.

You need to call Application.InitializeVBA method in your VFP program before you can use RunMacro...

This should help...
Reply With Quote
  #3  
Old 16-07-2003, 10:50
Craig Tucker
Guest
 
Posts: n/a
Default

FYI - CreateStructExportOptions works perfect in VFP8.0
Reply With Quote
  #4  
Old 17-07-2003, 12:51
BobReed
Guest
 
Posts: n/a
Default

Wow Guys, that did it!
Alex, thanks ever so much!
Bob
Reply With Quote
  #5  
Old 20-02-2005, 21:25
zlatev
Guest
 
Posts: n/a
Default

Whenever you need help with automation from within Visual FoxPro - do not hesitate to ask me.
I may say I have quite an experience with this kind of stuff.
Kind Regards,
Zlatin Zlatev, MCSD (VFP)
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
Adding a Reference on a pwd protected macro Rick Randall CorelDRAW/Corel DESIGNER VBA 9 27-10-2004 10:27
How do you successful call the DeInterlace sub? micahk Corel Photo-Paint VBA 2 03-05-2004 21:34
An Idea for a handy and easy to make macro vallentin Macros/Add-ons 2 16-03-2004 12:35
New macro to clip curves w.r.t. a border Gerard Hermans Macros/Add-ons 0 09-06-2003 08:50
Speeding up a macro Rick Randall CorelDRAW/Corel DESIGNER VBA 2 12-12-2002 11:51


All times are GMT -5. The time now is 21:19.


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