Wordart color macro

M

mcwhirt3

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.
 
E

Ed Bennett

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.
 
M

mcwhirt3

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.
 
E

Ed Bennett

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)
 
M

mcwhirt3

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
 
E

Ed Bennett

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.

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.
 

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