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? Thanks for any help.
mcwhirt3@msu.edu <mcwhirt3@msu.edu> was very recently heard to utter:
> 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.

Signature
Ed Bennett - MVP Microsoft Publisher
mcwhirt3@msu.edu - 18 Feb 2005 19:43 GMT
Thank you very much Ed for replaying. How do i tweak this code so that
if i select a piece of wordart then exeucte this code, that it will
apply this action. I'm using a userform as kind of a style bar and i'd
like to select a piece of wrdart click a butoon and then apply the
style.
Ed Bennett - 18 Feb 2005 19:56 GMT
mcwhirt3@msu.edu <mcwhirt3@msu.edu> was very recently heard to utter:
> Thank you very much Ed for replaying. How do i tweak this code so that
> if i select a piece of wordart then exeucte this code, that it will
> apply this action. I'm using a userform as kind of a style bar and i'd
> like to select a piece of wrdart click a butoon and then apply the
> style.
Look up the Selection object in the help file.
(Specificly, Selection.ShapeRange is where you want to be looking)

Signature
Ed Bennett - MVP Microsoft Publisher
mcwhirt3@msu.edu - 18 Feb 2005 20:01 GMT
Ed,
I have a userform with one text box and one commandbutton. I want to be
able to type into the textbox, and when i click on the commadbutton
have it draw a wordart with the settings in this code. I can find
anythnig that talks about inserting wordart, only everything else like
lines and shapes. Thanks for your help.
Private Sub CommandButton1_Click()
With ThisDocument.Pages(1).Shapes.AddTextEffect
With .TextEffect
.Text = TextBox1.Value
.FontBold = msoFalse
.FontName = "Nino Salvaggio Sign"
End With
.Fill.Solid
.Fill.ForeColor.RGB = RGB(255, 0, 0)
.Shadow.Visible = True
.Shadow.Type = msoShadow2
End With
End Sub
Ed Bennett - 18 Feb 2005 22:09 GMT
mcwhirt3@msu.edu <mcwhirt3@msu.edu> was very recently heard to utter:
> Ed,
>
[quoted text clipped - 3 lines]
> anythnig that talks about inserting wordart, only everything else like
> lines and shapes. Thanks for your help.
Look up the AddTextEffect method in the help file, and see what all the
arguments mean
You need to add brackets after AddTextEffect, and add all the non-optional
arguments in there.

Signature
Ed Bennett - MVP Microsoft Publisher