OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   Macro Call from VFP (http://forum.oberonplace.com/showthread.php?t=179)

BobReed 27-06-2003 17:04

Macro Call from VFP
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:
* do the color change thing
objSheet = oCRL11.ActiveDocument.ActivePage.Shapes.Item(strOName)
objSheet.Fill.UniformColor.RGBAssign (intRed,intGreen,intBlue)
* now comes the error:

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

Anybody have any clues here???

Thanks in advance

Alex 10-07-2003 18:52

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...

Craig Tucker 16-07-2003 10:50

FYI - CreateStructExportOptions works perfect in VFP8.0

BobReed 17-07-2003 12:51

Wow Guys, that did it!
Alex, thanks ever so much!

zlatev 20-02-2005 21:25

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)

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

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