View Single Post
 
Old 03-16-2015, 09:07 AM
rosscortb rosscortb is offline Windows XP Office 2010 32bit
Novice
 
Join Date: May 2014
Posts: 17
rosscortb is on a distinguished road
Default

Thanks

When Engineer is selected I also wanted the word "Engineer" to appear in the bookmark called position

Selection.GoTo What:=wdGoToBookmark, Name:="Position"
Selection.TypeText Me.cboPosition


Private Sub UserForm_Initialize()
With cboPosition
.AddItem "Nub"
.AddItem "Journeyman"
.AddItem "Engineer"
End With
End Sub
Private Sub cmdOK_Click()
If cboPosition.Value = "Engineer" Then
WriteToBM "Grade", "E"
End If
Hide

Selection.GoTo What:=wdGoToBookmark, Name:="Position"
Selection.TypeText Me.cboPosition
End If
Unload Me

End Sub
Sub WriteToBM(strName As String, strText As String)
Dim oRng As Word.Range
Set oRng = ActiveDocument.Bookmarks(strName).Range
oRng.Text = strText
ActiveDocument.Bookmarks.Add strName, oRng
End Sub


Ross

Last edited by rosscortb; 03-16-2015 at 09:10 AM. Reason: Added Code
Reply With Quote