I'm using a userform as a customized toolbar of sorts. In Microsoft
Publisher how can I write a macro so when commandbutton1 is pressed on
this userform, the wordart selected changes to my specified color and
has a predefined dropshadow and uses font arial?
This code works for me:
Sub AdjustWordArt()
With ThisDocument.Pages(1).Shapes(1)
With .TextEffect
.Text = "Sample Text"
.FontBold = msoTrue
.FontName = "Arial"
End With
.Fill.Solid
.Fill.ForeColor.RGB = RGB(255, 255, 0)
.Line.ForeColor.RGB = RGB(255, 0, 255)
.Line.Weight = 4
.Shadow.Visible = True
.Shadow.Type = msoShadow3
End With
End Sub
(you'll want to replce ThisDocument.Pages(1).Shapes(1) with a reference to
your shape, "Sample Text" to the text you want, and the colours and shadow
styles, etc. with values that you like)
You can find the help file for the Publisher VBA (including the complete
object model) at c:\Program Files\Microsoft Office\Office11\1033\VBAPB10.CHM
by default (may be different depending on your language and installation
folder) - this explains all of this in detail for you.
You may also want to look at Andrew May's technical article series on coding
in Microsoft Publisher -
http://msdn.microsoft.com/office/understanding/publisher/articles/default.aspx
is the page to look at.