![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Microsoft Office support MS Office support forum |
![]() |
|
|
Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Jul 2008
Posts: 2
OS: Vista
|
Using a macro to add a semicolon
I'm using Word in Office XP. I need to find each word in a document with title case and add a semicolon after the previous word. To find the mixed case words I've used:
For Each myText In myDoc.Words If myText.Case = wdTitleWord Then ...but I can't work out how to add the semicolon. Appreciate your help. |
|
|
|
|
|
#2 (permalink) |
|
Registered User
Join Date: May 2008
Location: Baltimore, Maryland
Posts: 97
OS: Windows XP SP3
|
Re: Using a macro to add a semicolon
You could write a routine such as:
Code:
Sub casecheck()
Dim idx As Long
idx = 2
Do While idx < ThisDocument.Words.Count
If ThisDocument.Words(idx).Case = wdTitleWord Then
ThisDocument.Words(idx - 1).Text = Trim(ThisDocument.Words(idx - 1).Text) & "; "
idx = idx + 1
End If
idx = idx + 1
Loop
End Sub
Cat owner Dog owner Bird owner After running the above code, it would be changed to: Cat owner; Dog owner; Bird owner Modify as necessary. Last edited by David M58 : 07-03-2008 at 10:13 PM. |
|
|
|
![]() |
| Thread Tools | |
|
|