Publisher 2007 VBA Question for Catalog Merge


R

Rudeseal

I am creating a Product Catalog and am using an Access 2007 database, in the
database I have 2 fields, one field is called "Color" to designate the color
of the Item, the 2nd Field is called "Colors" and it designates what other
colors are available for this particular item. The format of the fields are
simple Text. I use the following scheme to designate colors:

R= Red
W= White
B=Black
Q= Bisque
SS= Stainless Steel
BS= Brushed Chrome
PW= Pearl White

The Color field only has one of the color designation, the "Colors" field
has the designations seperated by a comma, so for example, Item 1 has 3
additional colors, they are in the field as "W,B,Q" or only one additional
color "B" without a comma.

Anyhow, here is where I am stuck and my newbieness with VBA shows up. On
the Catalog Merge, I can insert the Field on the document but I cannot see
how I can use the designations to create a color swatch on the page using VBA
code. Does anyone have any examples or code to get me started, or even a
webpage with samples of different ways of using the field data to modify what
is placed on the page?
 
Ad

Advertisements

C

Cory

If you are looking to just create a swatch of the color on the page, then you
can do something like so:

(This assumes you run the field value through a parser that figures out what
the colors depicted there are). Here I create a rectangle, and color it red.
Obviously, you would customize the size and placement of the rectangle (and
possibly the shape) and the color values to fit your need.

Dim Page As Page
Set Page = ActiveDocument.ActiveView.ActivePage

'Create a rectangle
Dim MyShape As Shape
Set MyShape = Page.Shapes.AddShape(Type:=msoShapeRectangle, _

Left:=Application.InchesToPoints(1.5), _
Top:=Application.InchesToPoints(1.5), _
Width:=Application.InchesToPoints(2), _
Height:=Application.InchesToPoints(2))

'Fill the rectangle with red color
MyShape.Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)

Cory
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top