connecting users of the CorelDRAW family of products

GDG Macros VBA Lessons

Page Details

First published by:
pranderson
on Sat, Sep 1 2012
Last revision by:
pranderson
on Mon, Oct 1 2012
10 people found this article useful.

CorelDRAW on Facebook

@CorelDRAW on Twitter

CorelDRAW on Google+

Share  

100% of people found this useful
GDG Macros VBA Lessons

Lessons involving VBA and Macros in CorelDRAW:

GDG Macros Lesson 1: Creating gms files from scratch, basics

GDG Macros Lesson 2: A very simple For Loop and Resample Bitmaps

GDG Macros Lesson 3: Add a basic form and increase size of some shapes

GDG Macros Lesson 4: Create box around a selected shape

GDG Macros Lesson 5: Put Margins on the box we created in the previous macro

GDG Macros Lesson 6: Passing values to a custom function By Reference and By Value

GDG Macros Lesson 7: A touch of WinAPI and using keyboard modifier keys

GDG Macros Lesson 8 - Part 1: Functions in more detail and adding to a Shaperange

GDG Macros Lesson 8 - Part 2: Functions in more detail and adding to a Shaperange

GDG Macros Lesson 9: Randomizing

GDG Macros Lesson 10: A single UNDO using CommandGroups and Optimization for Macro SPEED!

GDG Macros Lesson 11: Speed Up Your Macros with Optimization

GDG Macros Lesson 12: Record a macro basics

GDG Macros Lesson 13 Part 1: Save and Get Settings from the Registry

GDG Macros Lesson 13 Part 2: Save and Get Settings from the Registry

GDG Macros Lesson 14 Part 1: Shapes have static ids, and more on get and save to registry

GDG Macros Lesson 14 Part 2: Shapes have static ids, and more on get and save to registry

GDG Macros Lesson 14 Part 3: Shapes have static ids, and more on get and save to registry

GDG Macros Lesson 14 Part 4: Shapes have static ids, and more on get and save to registry

GDG Macros Lesson 14 Part 5 (Final Overview): Shapes have static ids, and more on get and save to registry

GDG Macros Lesson 15 Part 1: Get Colors, turn them into a String, and place in a Collection

GDG Macros Lesson 15 Part 2: Get Colors, turn them into a String, and place in a Collection

GDG Macros Lesson 15 Part 3: Get Colors, turn them into a String, and place in a Collection

GDG Macros Lesson 15 Part 4: Get Colors, turn them into a String, and place in a Collection

GDG Macros Lesson 16 part 1 of 8: Save many color value groups to the registry as presets

GDG Macros Lesson 16 part 2 of 8: Save many color value groups to the registry as presets

GDG Macros Lesson 16 part 3 of 8: Save many color value groups to the registry as presets

GDG Macros Lesson 16 part 4 of 8: Save many color value groups to the registry as presets

GDG Macros Lesson 16 part 5 of 8: Save many color value groups to the registry as presets

GDG Macros Lesson 16 part 6 of 8: Save many color value groups to the registry as presets

GDG Macros Lesson 16 part 7 of 8: Save many color value groups to the registry as presets

GDG Macros Lesson 16 part 8 of 8: Save many color value groups to the registry as presets

GDG Macros Lesson 17 Part 1 of 5: Fill a ComboBox with items, Parse strings, Dynamic Arrays

GDG Macros Lesson 17 Part 2 of 5: Fill a ComboBox with items, Parse strings, Dynamic Arrays

GDG Macros Lesson 17 Part 3 of 5: Fill a ComboBox with items, Parse strings, Dynamic Arrays

GDG Macros Lesson 17 Part 4 of 5: Fill a ComboBox with items, Parse strings, Dynamic Arrays

GDG Macros Lesson 17 Part 5 of 5: Fill a ComboBox with items, Parse strings, Dynamic Arrays

GDG Macros Lesson 18 Part 1 of 7: Write to a text file many colors values retrieved from presets save to the registry

GDG Macros Lesson 18 Part 2 of 7: Write to a text file many colors values retrieved from presets save to the registry

GDG Macros Lesson 18 Part 3 of 7: Write to a text file many colors values retrieved from presets save to the registry

GDG Macros Lesson 18 Part 4 of 7: Write to a text file many colors values retrieved from presets save to the registry

GDG Macros Lesson 18 Part 5 of 7: Write to a text file many colors values retrieved from presets save to the registry

GDG Macros Lesson 18 Part 6 of 7: Write to a text file many colors values retrieved from presets save to the registry

GDG Macros Lession 18 Part 7 of 7 (FINAL OVERVIEW) : Write to a text file many colors values retrieved from presets save to the registry

GDG Macros Lession 19: Fountain Fill colors and adding them to a collection

GDG Macros Lesson 20 Part 1 of 3: More (Fantastic Fun) with Fountain Fill Colors

GDG Macros Lesson 20 Part 2 of 3: More (Fantastic Fun) with Fountain Fill Colors

GDG Macros Lesson 20 Part 3 of 3: More (Fantastic Fun) with Fountain Fill Colors

GDG Macros Lesson 21 Part 1 of 5: Access the font list in VBA and make a custom macro to quick select a font via filter

GDG Macros Lesson 21 Part 2 of 5: Access the font list in VBA and make a custom macro to quick select a font via filter

GDG Macros Lesson 21 Part 3 of 5: Access the font list in VBA and make a custom macro to quick select a font via filter

GDG Macros Lesson 21 Part 4 of 5: Access the font list in VBA and make a custom macro to quick select a font via filter

GDG Macros Lesson 21 Part 5 of 5: Access the font list in VBA and make a custom macro to quick select a font via filter

GDG Macros Lesson 22 Part 1 of 5: Scroll Bar Form Controls and affecting a shapes outline width & more

GDG Macros Lesson 22 Part 2 of 5: Scroll Bar Form Controls and affecting a shapes outline width & more

GDG Macros Lesson 22 Part 3 of 5: Scroll Bar Form Controls and affecting a shapes outline width & more

GDG Macros Lesson 22 Part 4 of 5: Scroll Bar Form Controls and affecting a shapes outline width & more

GDG Macros Lesson 22 Part 5 of 5: Scroll Bar Form Controls and affecting a shapes outline width & more

GDG Macros Lesson 23 Part 1: Save and set the macro from position

GDG Macros Lesson 23 Part 2: Save and set the macro from position

GDG Macros Lesson 24 Part 1: Aligning a shape to a range of shapes, and using boolean conditions

GDG Macros Lesson 24 Part 2: Aligning a shape to a range of shapes, and using boolean conditions

GDG Macros Lesson 24 Part 3: Aligning a shape to a range of shapes, and using boolean conditions

GDG Macros Lesson 24 Part 4 (Final Part): Aligning a shape to a range of shapes, and using boolean conditions

GDG Macros Lesson 25: That Tricky Selection Shape, AKA: cdrSelectionShape

GDG Macros Lesson 26: Allow the macro user to make a click and get the click point coordinates, Method: GetUserClick

GDG Macros Lesson 26: Allow the macro user to make a click and get the click point coordinates, Method: GetUserClick

GDG Macros Lesson 27 Part 1 of 3: Select shapes at a point using GetUserClick Coordinates

GDG Macros Lesson 27 Part 2 of 3: Select shapes at a point using GetUserClick Coordinates

GDG Macros Lesson 27 Part 3 of 3: Select shapes at a point using GetUserClick Coordinates

GDG Macros Lesson 28 Part 1 of 7: Apply a color to a form command button, loop form controls, and save and get the color

GDG Macros Lesson 28 Part 2 of 7: Apply a color to a form command button, loop form controls, and save and get the color

GDG Macros Lesson 28 Part 3 of 7: Apply a color to a form command button, loop form controls, and save and get the color

GDG Macros Lesson 28 Part 4 of 7: Apply a color to a form command button, loop form controls, and save and get the color

GDG Macros Lesson 28 Part 5 of 7: Apply a color to a form command button, loop form controls, and save and get the color

GDG Macros Lesson 28 Part 6 of 7: Apply a color to a form command button, loop form controls, and save and get the color

GDG Macros Lesson 28 Part 7 of 7: Apply a color to a form command button, loop form controls, and save and get the color

GDG Macros Lesson 29: Find and replace, and naming your variables and other items

GDG Macros Lesson 30 Part 1 of 9: Find all shapes from all pages that use a particular font, then highlight them

GDG Macros Lesson 30 Part 2 of 9: Find all shapes from all pages that use a particular font, then highlight them

GDG Macros Lesson 30 Part 3 of 9: Find all shapes from all pages that use a particular font, then highlight them

GDG Macros Lesson 30 Part 4 of 9: Find all shapes from all pages that use a particular font, then highlight them

GDG Macros Lesson 30 Part 5 of 9: Find all shapes from all pages that use a particular font, then highlight them

GDG Macros Lesson 30 Part 6 of 9: Find all shapes from all pages that use a particular font, then highlight them

GDG Macros Lesson 30 Part 7 of 9: Find all shapes from all pages that use a particular font, then highlight them

GDG Macros Lesson 30 Part 8 of 9: Find all shapes from all pages that use a particular font, then highlight them

GDG Macros Lesson 30 Part 9 of 9: Find all shapes from all pages that use a particular font, then highlight them

 

[I] Other CorelDRAW Videos with Misc Tips and Tricks:

GDG Tips & Tricks 1: Using the Low Pass bitmap filter to smooth and thicken or thin a design

 

--------------------------------------------------

"The best thing about learning is that it never stops, and the rabbit hole will go as deep as you let it."
~John
www.gdgmacros.com

Recent Comments

By: CorelDRAW.com administrator Posted on Wed, May 7 2014 10:21

We are working at getting these links fixed in the next few days with no work from GDG John..

By: CorelDRAW.com administrator Posted on Thu, May 8 2014 15:33

We are rolling out the fix and the images should now display correctly.

By: Frameworks Posted on Thu, May 8 2014 18:13

To confirm, it appears that GDG John's excellent VBA Macro-Writing Tutorials/Videos are back up and displaying correctly -- THANK YOU SO MUCH!!!

By: flysociety Posted on Thu, Jun 26 2014 14:13

Great work. Thanks John. I am new to VBA and your tutorials help  me  a lot.

By: flysociety Posted on Thu, Jun 26 2014 14:43

Hi  guys, I'm not sure whether this is the right forum to post this, I am new to VBA  (not programming) trying to code  2 macros one to create a date stamp string  on a document when clicked and the other one for updating the selected date string.See code below and please help me on how to make my date stamp string unique so that when the user is creating  the new date the code check if date string exist in the active page, thought of saving the staticID of the date string to the registry. The problem with that  is that when the user create the string  the ID will be saved to registry  of that user's computer, so  when the other user who is in the same network open the same document  the following day and try to update the date string after editing the IDs wont be available on his or her registry. Thanks in Advance

###########################################################################################

'calculate the font size of the date string  using lenghth and width of the border

Function dateSize!(s As Shape)

   dateSize = CSng((20 / 100) * (s.SizeWidth * s.SizeHeight))

End Function

Sub setDate()

   Dim strCopyRight$, myDate$, dateID$

   Dim DateString As Shape, s As Shape, myBorder As Shape

   Dim fontSize!

   Dim dPostionX#, dPostionY#

   ActiveDocument.Unit = cdrInch

   Set myBorder = ActiveShape()

   'check something is selected

   If myBorder Is Nothing Then

       MsgBox "No shape selected.Please select a shape and try Again?", vbOKOnly

       Exit Sub

   End If

   'check if the selected shape is a valid shape

   If myBorder.Type = cdrCurveShape Or myBorder.Type = cdrRectangleShape Then

       fontSize = dateSize(myBorder)

       dPostionX = myBorder.LeftX

       dPostionY = myBorder.BottomY - 0.1

       myDate = VBA.Format(Date, "dd/mm/yyyy")

       strCopyRight = "Flysociety LTD. © " & myDate

       Set DateString = ActiveLayer.CreateArtisticText(dPostionX, dPostionY, strCopyRight, , , "Arial", fontSize)

   End If

End Sub

Sub updateDate()

   Dim copyRightDate$, myDate$

   Dim DateString As Shape, outDated As Shape

   Dim fontSize!

   Dim dPostionX#, dPostionY#

   ActiveDocument.Unit = cdrInch

   'retrieve staticID of a shape from the registry

   'dateID = GetSetting("CREATE-COPY-RIGHT-AND-DATE", "Pref_" & VersionMajor, "StaticID")

   Set outDated = ActiveShape()

   'check something is selected

   If outDated Is Nothing Then

       MsgBox "No date string selected.Please select date string and try Again?", vbOKOnly

       Exit Sub

   End If

   'check if the selected shape is a valid shape

   If outDated.Type = cdrTextShape Then

       myDate = VBA.Format(Date, "dd/mm/yyyy")

       copyRightDate = "Flysociety LTD. © " & myDate

       outDated.Text.Replace outDated.Text.Story.Text, copyRightDate, True

   End If

End Sub

© Corel Corporation. The content herein is in the form of a personal web log ("Blog") or forum posting. As such, the views expressed in this site are those of the participants and do not necessarily reflect the views of Corel Corporation, or its affiliates and their respective officers, directors, employees and agents. Terms and Conditions / User Guidelines.