OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   Making an executable (http://forum.oberonplace.com/showthread.php?t=425)

ddonnahoe 05-03-2004 15:20

Making an executable
 
I have a macro that I wrote that creates a our company order form and fills it with the info from the form that loads at the beginning. I also have VB6 and was wondering how I can pull this macro into VB and create an executable that will open Corel Draw and execute the macro. If I could I would like to open Corel minimized, but I think this is un-do-able.

Thanks for any help.

Alex 05-03-2004 22:01

Re: Making an executable
 
Sean,

The simplest solution would be to export all the modules and forms from VBA into .BAS and .FRM files (right-click a module/form in VBA and choose "Export"). Then Create a new VB application, delete the default form it gives, import all the BAS/FRM files you exported from VBA (right click in Project Explorer, select Add>Add File).

Now rename your entry macro subroutine into "Sub Main()".

Finally add a reference to CorelDRAW type library (Project>References and put a checkmark next to "Corel - CorelDRAW 12.0 Library")..

This should do it.

ddonnahoe 06-03-2004 13:39

I tried to do what you said and when I went to compile to exe, I got an error that says: "Compile Error: Method or data member not found."

I am using CD11 and the code that it is referring to is s5.GetPosition x, y

the get position is the part that it highlights and I don't understand what is happening.

Also, in the advanced option in the "make executable" window, should I change any of those settings?

Alex 06-03-2004 14:36

Are you sure you have added the reference to CorelDRAW 11 type library in the VB project?

Alex 06-03-2004 14:39

Oh, one more thought: Whenever you use CorelDRAW classes (like Document, Application, Shape, etc), add the type library name in front of it to resolve ambiguity. VB has a Shape class which represents a special control on the form. So there are two different classes of Shape - one defined in VB and one in CorelDRAW. You need to either move CorelDRAW type library reference before those of VB in the Refereneces dialog or use CorelDRAW explicitly when difining types:

Code:

Dim s5 As CorelDRAW.Shape
This should help.

ddonnahoe 06-03-2004 20:48

Changing that worked, but when I run the EXE all i get is the form. How do I get it to launch CorelDraw first?

Alex 09-03-2004 09:42

I guess we need to step back (again). You should describe what you need to do, from A to Z, and we'll see how this could be done.

ddonnahoe 10-03-2004 09:21

3 Attachment(s)
I have created a form for our sales staff to use to input order information on to our work orders. The VBA takes the information and creates the order form on a blank document at which point the document can be printed or saved (users choice). Currently the sales person has to open Draw to click on the macro button. What I'm trying to do is eliminate the part about opening Draw. I would like to have an executable on their desktop that they can click that will allow them to enter the info and have Draw open automatically and create and print the document. The code changes that you have suggested so far have worked great, except that Draw doesn't open. I just get the form and it seems to runthe script in the background, but doesn't print. I assume this is because draw is not actually open.

Below is the form that is created.

Alex 10-03-2004 10:06

Ok, now it makes it clearer. :)

When you run your program it actually loads CorelDRAW but it stays invisible in the background. To remedy this, the first thing you need to do is to make it visible:

Code:

Dim draw As CorelDRAW.Application
Set draw = New CorelDRAW.Application
draw.Visible = True
' Do your other stuff here
' .....

P.S. CorelDRAW should still print even if it is invisible. Doesn't it? Or maybe you are showing the print dialog and because it is invisible the user cannot click the Print button?

olympiatr 13-04-2004 09:25

Re: Making an executable
 
Quote:

Originally Posted by ddonnahoe
I have a macro that I wrote that creates a our company order form and fills it with the info from the form that loads at the beginning. I also have VB6 and was wondering how I can pull this macro into VB and create an executable that will open Corel Draw and execute the macro. If I could I would like to open Corel minimized, but I think this is un-do-able.

Thanks for any help.

YOU CAN FIND YOUR ANSWER AT CORELDRAW 12'S VBA HELP. I REMEMBER I READ IT LAST WEEK. IF YOU CAN'T FIND, WRITE TO ME. I CAN FIND IT FOR YOU.


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

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