View Single Post
 
Old 05-15-2014, 11:08 AM
jpb103's Avatar
jpb103 jpb103 is offline Windows 7 64bit Office 2007
Advanced Beginner
 
Join Date: May 2014
Location: Thunder Bay, Ontario
Posts: 58
jpb103 is on a distinguished road
Default

So if you put a bookmark at a location where you want to put the text the user has entered, you could do something like this:
Code:
Dim BMRange As Range 
Dim pInput As String
'Prompt user for input'
pInput = InputBox("Enter the number of wells." _
, "Populate Template")
'Error handler for user cancel'
If pFindTxt = "" Then
  MsgBox "Cancelled by User"
  Exit Sub
End If
'Identify current Bookmark range and insert text 
Set BMRange = ActiveDocument.Bookmarks("WellBookmark").Range 
BMRange.Text = pInput 
'Re-insert the bookmark 
ActiveDocument.Bookmarks.Add "WellBookmark", BMRange
Where "WellBookmark" is the name of the bookmark where you wish to place the text. I haven't tested it though, so you might want to try using it on a copy first. Hopefully this helps, at the very least it's a starting point for you to start messing around with macros. Good Luck!
Reply With Quote