Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-22-2014, 10:17 AM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Macro to insert WordArt characters Windows XP Macro to insert WordArt characters Office 2007
Competent Performer
Macro to insert WordArt characters
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default Macro to insert WordArt characters

I need a macro to insert WordArt characters using the WordArt Style 1 (outline). I want to be able to enter the text and select the font.

Using the macro recorder, I came up with this:

Code:
Sub MyWordArtOutline()
Const MyName As String = "MyWordArtOutline"
Dim InString As String  'The string of characters to be inserted
Dim i As Long
Dim Font As String
Dim char As String

InString = InputBox("Enter the string", MyName)
Font = InputBox("Enter the name of the font", MyName)
For i = 1 To Len(InString)
  char = Mid(InString, i, 1)
  ActiveDocument.Shapes.AddTextEffect(msoTextEffect1, char, _
    Font, 36#, msoFalse, msoFalse, 239.25, 233.6).Select
  Selection.MoveRight Unit:=wdCharacter, Count:=1
Next i

End Sub
It works, but it could work better. I have a few questions:



  1. Is there any way for the macro to put the list of available fonts so the user can select one, instead of having to type in the name?
  2. The WordArt letters some in in the middle of the page and all on top of each other. How can I get them to be side by side at the cursor?
  3. Can anyone explain what the other WordArt parameters mean (msoFalse, 239.25, 233.6?
Thanks
Reply With Quote
  #2  
Old 02-25-2014, 03:10 AM
macropod's Avatar
macropod macropod is offline Macro to insert WordArt characters Windows 7 32bit Macro to insert WordArt characters Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Jennifer,

Try:
Code:
Application.CommandBars("WordArt").Controls(1).Execute
As for 'msoFalse, 239.25, 233.6' the AddTextEffect parameters are:
AddTextEffect(PresetTextEffect, Text, FontName, FontSize, FontBold, FontItalic, Left, Top)
Thus you have:
Code:
AddTextEffect(PresetTextEffect:=msoTextEffect1, Text:=char, FontName:=Font, FontSize:=36#, _
  FontBold:=msoFalse, FontItalic:=msoFalse, Left:=239.25, Top:=233.6)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to insert WordArt characters How to insert paragraph character after every 500 characters? aditya_bokade Word VBA 28 11-13-2021 10:48 PM
Macro to find text in between two characters and then format selected text? qcom Word 5 02-19-2015 11:23 PM
Macro to insert new page... samanthaj Word 17 01-31-2012 01:53 PM
Macro to insert WordArt characters Macro for Picture Insert rfhall50 Word VBA 2 10-25-2010 12:41 PM
Junk characters (box-like characters) in Word file Sashikala Word 1 04-20-2010 02:03 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:55 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft