Full Version: VBA Macros

From: Stunt Engraver (DGL) [#5]
 1 Jul 2006
To: Carl (CSEWELL) [#4] 1 Jul 2006

Carl,

Although I don't use Corel, I think it's safe to say, for many of us in this industry, despite the program's inherent power, we only use very basic features of our graphics programs.

I'll ask the dumb question:

What does VBA stand for?

From: Carl (CSEWELL) [#6]
 1 Jul 2006
To: Stunt Engraver (DGL) [#5] 1 Jul 2006

quote:
we only use very basic features of our graphics programs


That's what I was trying to understand and explains why a lot of people I talk to are content in staying at earlier versions, some as early as 8 and even 7! I'm not one to be on the bleeding edge of technology, but I don't like to fall off the other side either! ;^) All joking aside, if it works for you, that's all that matters.

There was a poll about what version people are at. And that may explain a lot also since I'm not sure when VBA was implemented in CorelDraw (10? maybe 11?). I haven't put a lot of time or effort in writing macros for Corel because I don't know if it will be a long-term benefit. It definitely has a short-term benefit because they are written to a specific need and a specific way of doing things, which may not be the way other people do things. I thought that might be more prevalent by industries... maybe not. There are CorelDraw specific forums that address just about every aspect of Corel.

The only dumb question is the one that doesn't get asked.

VBA => Visual Basic for Applications

Microsoft's attempt at allowing programmers to make Microsoft applications work.

From: UncleSteve [#7]
 1 Jul 2006
To: Carl (CSEWELL) [#6] 1 Jul 2006

Carl,

Other than Harvey, I don't think most engravers are, or want to be, programmers....


From: Carl (CSEWELL) [#8]
 1 Jul 2006
To: UncleSteve [#7] 1 Jul 2006

Oh, but you are! Every time you use a computer, you ARE programming it!

You don't have to be a programmer to use VBA or macros. And I certainly don't want to be a programmer either, but I'm very lazy! I hate having to do the same thing over and over again. I'd rather do it once the hard way and reap the benefits from that day forward! It's a tool just a like template or a fixture. An investment in the future!

From: Engravin' Dave (DATAKES) [#9]
 1 Jul 2006
To: Carl (CSEWELL) [#8] 1 Jul 2006

Carl,

You bring up a good subject. There are some macros that would be great for all of us to have, but I think most of us fall short because we don't recognize what we are missing.

Maybe you could highlight a few basic ones in this thread, and you never know, someone could come up with a tutorial showing how to implement a macro into CorelDRAW.


From: Mike (MIKEN) [#10]
 1 Jul 2006
To: ALL

Carl:

In my limited use I've also found Oberon to be useful. He has a corner rounding macro which was essential in earlier Corel versions. That feature is fixed in X3 .

You may want to have a look at this site. http://www.isocalc.com/cooltools/index.htm

EDITED: 1 Jul 2006 by MIKEN


From: Carl (CSEWELL) [#11]
 1 Jul 2006
To: Engravin' Dave (DATAKES) [#9] 1 Jul 2006

quote:
Maybe you could highlight a few basic ones in this thread


Okay... a few:

Does the array copy exist in X3? Do people do a lot of array copying? Do you do it using the Transformation tool one object or row or column at a time? How often do you do this?

People are always asking about print/merge, which, if I understand it correctly is an "at print time" result. Can you manipulate the results or do you have to live with what you get? Would importing the names (reading them from a file) and distributing (arraying) them save time/effort? Do you manually resize each name to fit a specific area?

Those two were the ones that I thought would be abundant in variations and availability. Yes, the Oberon site has one (tiling), but it doesn't work the way that I work. Does anyone use it? There's also IsoCalc.com but most of those stop at version 9.

I have several macros that work specifically with layers. I'm not sure that the work in this industry would require the use of layers, but I've always worked that way so it is beneficial to me. Do you work in multiple layers to reduce complexity of selecting/moving/changing objects? Or are the layouts simple text? Do you frequently move objects between layers? Do you turn layers on and off to reduce the complexity?

The easiest question to answer should be: What do you do repeatedly in CorelDraw that you wish were simpler/quicker/easier to do? There may not be anything. For me, there's a lot. Some can't be easily implemented in macros. I was hoping someone has gone through this and could share their experiences.

It's fairly easy to implement an existing macro: copy the file to a specific folder, start Corel, Tools> Visual Basic > Play, then select the macro. You can also add it as a command on a toolbar, which isn't the easiest thing to do, but we're talking minutes and not hours to implement. I have a flyout specifically for macros.

************
Update 7/3/2006: Custom toolbars for macros can be made and then exported. These toolbars would include icons/descriptions, etc. It would be a two step process for a VBA macro user: copy the GMS file to the correct directory and then import the toolbar (right-click on the a toolbar, click on Customize>Workspace>Import Workspaces....). If you don't periodically export your workspace to save a working copy, you might want to start just in case you have go back to the system defaults for whatever reason.
*************

However, if most people are still running v9 or whatever version is before the implemenation of VBA, then the VBA macros wouldn't benefit them. Recording a macro and VBA macros, I think, are two totally different things.

EDITED: 3 Jul 2006 by CSEWELL


From: Mike (MIKEN) [#12]
 1 Jul 2006
To: Carl (CSEWELL) [#11] 1 Jul 2006

Carl:

For me print merge would be a great help if I could size and locate names after the merge but I don't believe that's possible. I do use it for office nameplates where the plate is pretty much uniform.

EDITED: 1 Jul 2006 by MIKEN


From: Carl (CSEWELL) [#13]
 1 Jul 2006
To: Mike (MIKEN) [#12] 1 Jul 2006

quote:
if I could size and locate names after the merge


Absolutely.

From: Shaddy [#14]
 1 Jul 2006
To: Carl (CSEWELL) [#8] 1 Jul 2006

I think we tend to fall back on what we know when we run into a wall. I have a VB background (no official training, just learning it on my own or from internet samples). So when I'm in Corel and doing anything repetitive, I try to think of a VB way to automate it. I may spend 20 times as long making a macro as I would doing it by hand, but figuring out things like that are fun for me.

My problem with my background is making a useful macro that anyone can use without trouble. I tend to piece things together and there would probably be unknown results under circumstances that were different than my own.

I didn't care for the Print merge function, so I made a sheet of shapes with text boxes, then I used a macro to pull lines of text from a file and fill the boxes. It also recognized that the text ran off the box, so it incrementally shrunk the text until it all fit in the box. But it was too customized for me to feel comfortable releasing it here. You should post some here if you have some ready, it might be enough to generate interest and get other people starting to make engraving specific macros.

Feel free to join here, they are all VBA programmers for CorelDRAW.
http://forum.oberonplace.com/forumdisplay.php?f=16

Shaddy

From: Carl (CSEWELL) [#15]
 1 Jul 2006
To: Shaddy [#14] 1 Jul 2006

Thank you! That's the type of input I was looking for.

No code is perfect. Look at Microsoft and all the patches that they release. And those are professionals! The person that attempts to develop totally foolproof code is a fool! Okay, not totally true, but there are limitations to everything. For something like this, a lot of error checking may not be critical, or maybe others might be willing to contribute to the code.

I've been to the Oberon VBA forum, but haven't joined or spent much time there. I was hoping there would be something more specific to the engraving industry.

I was hoping to open a line of dialogue to see if this was something we, as a group, thought was important to tackle. And, more importantly, if CorelDraw VBA was stable enough between versions to make it worthwhile. The one macro I wrote that another user tried in X3 which forced them to do a system restore scares me. If CorelDraw VBA is that unstable, then developing macros might not be a good idea. Then again, if we tend to hang onto versions of CorelDraw forever, it might be beneficial.

And because of the presumed instability, I'd hate to release a macro that caused people to have to do a system restore. Are you willing to take that risk? What version of Corel are you using? Are you comfortable working with GMS files and creating command buttons for macros?

EDITED: 1 Jul 2006 by CSEWELL


From: Shaddy [#16]
 1 Jul 2006
To: Carl (CSEWELL) [#15] 1 Jul 2006

I've had to restart before, but system restore? I wouldn't have thought that possible either. Maybe upping that code to Oberon and have that Alex guy look at it. He's very aware of the differences.

I have 12 on one machine, and X3 on the other, so far mine have ported over, but I didn't do anything too extreme.

I tend to stay with using the editor, I've only made one GMS file.

Buttons, I've added macros to the Global GMS and then added custom buttons to access them. Putting them in a custom GMS would probably be better, but I tend to take the easy way out and if just cut-n-paste works I'll probably do that.

I'll play with some macros and post them. Do you think GMS would be best for that?

Shaddy


From: Dave Jones (DAVERJ) [#17]
 1 Jul 2006
To: Shaddy [#16] 1 Jul 2006

EDIT: Crap. I hit the wrong reply button. This was aimed at Carl, not shaddy.

quote:
You don't have to be a programmer to use VBA


I don't agree. I haven't tried the CD VBA (my 1st version of CD and only had it 2 months), but I've written VBA code in other programs. It is an easy programming language that most people could learn enough to do some simple things. But it is still a programming language and if you've never written any code in any language then you would be lost as to where to start. So most people wouldn't even try.

Since I've only used CD for a couple of months, I'm still learning what features it does have, and haven't started thinking about what it doesn't do that I would use VBA to add to it.

Something else to consider is that often when people write scripts/macros/VBA to automate something they need to do, they don't write it in a generic enough form that it would be of use for a range of other people. People don't all have the same workflow. Plus when somebody slaps together a script they often stick constants in that should be variables with controls if it were a generic script for others to use.

My guess is that if we discuss some of what people find tedious and repetitive in CD, that those who know how to write VBA might be able to slap something together to help. After a few of those, some more people might get the idea of the power VBA could add and might take a shot at learning to write something themselves.

EDITED: 1 Jul 2006 by DAVERJ


From: Carl (CSEWELL) [#18]
 1 Jul 2006
To: Dave Jones (DAVERJ) [#17] 1 Jul 2006

quote:

Carl: You don't have to be a programmer to use VBA

Dave: I don't agree.


Use VBA, as in use VBA macros, not use as in write VBA macros.

If you are referring to the usability of the macros, yes, some macros may not be usable for people that don't know VB. It all depends on the macro. For example, in my XYCopy macro, the user is presented with a form for entering the X-distance, Y-distance, number of rows, and number of columns. If the user hasn't selected something before running the macro, a message box will tell them so. Is that generic enough? Yes, the macro has some rudimentary error checking, like verifying that numbers (not text) are entered. It even has an undo command. It doesn't save the user-entered values (I think you have to store them in the registry!) when you re-execute the macro. And the focus remains with the form so you can't do anything else until you exit the macro.

If the macros are documented (abundant comments) even hard-coded items could be more easily changed than creating a whole new macro. All of this assumes that people will take the time to do a good (not necessarily excellent) job with the macros.

Other macros may not require any user interface, they may just perform a function: turn off all layers except the current layer, turn on all layers, move selected objects to the current layer, save the current file as version 9 and add the suffix "-v9" to the base filename.

I wouldn't wish VB on anyone and certainly not anyone that hasn't had substantial programming experience. I find it extremely difficult and tedious.

Thanks!

From: Dave Jones (DAVERJ) [#19]
 1 Jul 2006
To: Carl (CSEWELL) [#18] 1 Jul 2006

Sorry, I thought you were saying anybody could write one.

As Emilly Litella (Gilda Radner) used to say: "Nevermind". :D 


From: Harvey only (HARVEY-ONLY) [#20]
 1 Jul 2006
To: Dave Jones (DAVERJ) [#19] 1 Jul 2006

Darn: Meant to post to ALL

This may be the place to find out what macros engravers might need. Cannot think of a better one.

EDITED: 1 Jul 2006 by HARVEY-ONLY


From: Carl (CSEWELL) [#21]
 1 Jul 2006
To: Dave Jones (DAVERJ) [#19] 1 Jul 2006

quote:
"Nevermind".


No! You made some excellent points: all relevant and right on the money.

From: Shaddy [#22]
 1 Jul 2006
To: Carl (CSEWELL) [#21] 1 Jul 2006

After the holiday break, I'll purdy up the macro for adding text to different objects as a replacement to the print merge. Well, not a replacement, Print merge is a powerful feature. Maybe it's more of a supplement.

There's a few macros that support this funtion that coule probably be applied to different processes. One is a macro that changes the "name" of an object of everything selected (the name that you can see in the object manager). That makes it easier for VBA to be selective on the things it alters. Such as, on a name badge you could have a generic company name called "Company", and a personalized name called "Name" or whatever makes sense to you. Then my code can more easily either change all the company names to the next company you make for, or go out and look at your list of names to fill in the other boxes with (sizing font accordingly for longer names).

Looking forward to seeing where this goes. Might even warrant a new folder here :D 

Shaddy


From: UncleSteve [#23]
 1 Jul 2006
To: Shaddy [#22] 2 Jul 2006

Hmmm..... sounds like premium content to me! ;-) 

(Are you reading this, David?)


From: Carl (CSEWELL) [#24]
 1 Jul 2006
To: Shaddy [#22] 2 Jul 2006

Are you interested in trying a few of my macros AT YOUR OWN RISK? I can e-mail them to you as GMS files. The XYCopy might be a good start.

I completed a beta version of the print merge last night. It reads from a hard-coded text filename (temporary only!), copies the selected text and replaces the first word (of the selected text) with the name (one per line) in the text file. The copying is an extension of the XYCopy macro. Not at all elegantly encoded, but it appears to work. It doesn't work correctly with first name and last name, just yet, because of the property I selected to make the replacement. There's probably a better way. It might be easier to use a 'FIELD' as you suggested, but that might be too involved for a novice user to set up.

We'll have to get David to pony up some development funds. ;^)

Show messages:  1-4  5-24  25-35

Back to thread list | Login

© 2024 Project Beehive Forum