Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-15-2014, 10:42 AM
Wordsquirrel Wordsquirrel is offline Create a Form to Build a Document Windows 7 64bit Create a Form to Build a Document Office 2010 64bit
Novice
Create a Form to Build a Document
 
Join Date: May 2014
Posts: 4
Wordsquirrel is on a distinguished road
Default Create a Form to Build a Document

Hello word world,


just want to create a form which a user can enter a few frequently used terms (like cross-references/bookmarks). These terms will get entered throughout a document.

It's easier in example:
The Document describes a design which has slightly different parameters. In the Form, a line will say "Enter the number of wells". They enter "five", and the word "five" is put in all the predetermined slots throughout the document template. Like the sentence "this design has [five] wells".

I am sure it's easy, I just can't find a guide to creating this type of form using google.
Reply With Quote
  #2  
Old 05-15-2014, 10:50 AM
jpb103's Avatar
jpb103 jpb103 is offline Create a Form to Build a Document Windows 7 64bit Create a Form to Build a Document Office 2007
Advanced Beginner
 
Join Date: May 2014
Location: Thunder Bay, Ontario
Posts: 58
jpb103 is on a distinguished road
Default

Would a macro work? If you already have a document template with those predetermined slots bookmarked, you could write a macro that prompts the user to enter values (for # of wells, etc, etc) and then populate the area of the document template marked by the bookmarks with the values entered.
Reply With Quote
  #3  
Old 05-15-2014, 10:56 AM
Wordsquirrel Wordsquirrel is offline Create a Form to Build a Document Windows 7 64bit Create a Form to Build a Document Office 2010 64bit
Novice
Create a Form to Build a Document
 
Join Date: May 2014
Posts: 4
Wordsquirrel is on a distinguished road
Default

Very likely, but I'm not sure I have the programming prowess to do it yet.
I've been looking into Templates, AutoText, and Smart Documents as possible solutions but I know nothing about those features.

In a nutshell: I have a 'boilerplate template' with a bunch of 'variable' slots that I want linked to one Form.

I'm just trying to clearly define what I'm looking for here. JPB103, I think you understand based on your response.
Reply With Quote
  #4  
Old 05-15-2014, 11:08 AM
jpb103's Avatar
jpb103 jpb103 is offline Create a Form to Build a Document Windows 7 64bit Create a Form to Build a Document 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
  #5  
Old 05-15-2014, 11:15 AM
Wordsquirrel Wordsquirrel is offline Create a Form to Build a Document Windows 7 64bit Create a Form to Build a Document Office 2010 64bit
Novice
Create a Form to Build a Document
 
Join Date: May 2014
Posts: 4
Wordsquirrel is on a distinguished road
Default

I see where this is going, I'll play with it. Thanks!
Reply With Quote
  #6  
Old 05-15-2014, 01:15 PM
Wordsquirrel Wordsquirrel is offline Create a Form to Build a Document Windows 7 64bit Create a Form to Build a Document Office 2010 64bit
Novice
Create a Form to Build a Document
 
Join Date: May 2014
Posts: 4
Wordsquirrel is on a distinguished road
Default

Hmm i can't seem to get it to work, is there a method were I can set up an input form, and the output would be my document with all the variable terms replaced?
Reply With Quote
  #7  
Old 05-16-2014, 05:13 AM
jpb103's Avatar
jpb103 jpb103 is offline Create a Form to Build a Document Windows 7 64bit Create a Form to Build a Document Office 2007
Advanced Beginner
 
Join Date: May 2014
Location: Thunder Bay, Ontario
Posts: 58
jpb103 is on a distinguished road
Default

Not that I know of off hand. I've had plenty of programming experience but I'm fairly new to composing macros. You might want to look into (google) VBA code for creating simple forms. Out of curiosity, what part of the macro above did not work? Did the input box appear to prompt the user?
Reply With Quote
  #8  
Old 05-16-2014, 10:33 AM
Charles Kenyon Charles Kenyon is online now Create a Form to Build a Document Windows 7 64bit Create a Form to Build a Document Office 2010 32bit
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,125
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Repeating Data (Populating Multiple Like Fields)

Create & Employ a Userform
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a Form to Build a Document One document build from subfiles duckman Word 3 03-04-2014 10:12 AM
Build a document from a set of standard paragraphs by using a tick list to select tho pete knight Word 9 11-13-2013 02:05 AM
Build a form with tables, first time Jarubell Word 0 08-25-2012 07:09 PM
Create a Form to Build a Document How to create an Excel add in that will automatically build tables from data selvamariappan Excel Programming 1 12-12-2011 03:11 AM
Create a Form to Build a Document Create Table Form from Word Document gsj224 Word VBA 3 07-31-2011 09:26 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:10 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