Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Macro...adding text

Status
Not open for further replies.

pauljj

Programmer
Oct 26, 2006
17
GB
Below is a sample of the code I am using, hopefully the answer is not too complicated the string I want to insert, is for example dlgtitle1 and I want that to insert onto the bookmark 'Name1' If I also want String 'dlgSurname1' to be inserted after a space and dlgtitle1 how do I combine them both



Sub AutoNew()
FxFrmInfo.Show
Application.ScreenUpdating = False

If dlgCancelled = False Then
Selection.GoTo What:=wdGoToBookmark, Name:="Name1"
Selection.TypeText Text:=dlgTitle1
Selection.GoTo What:=wdGoToBookmark, Name:="Name2"
Selection.TypeText Text:=dlgTitle2
Selection.GoTo What:=wdGoToBookmark, Name:="Address1"
Selection.TypeText Text:=dlgAddress1



Any ideas will be much apprreciated
 
Exactly how best to do it depends a little on circumstance, but sticking with the format you have:

[blue][tt] Selection.TypeText Text:=dlgTitle1 & " " & dlgSurname1[/tt][/blue]

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top