![]() |
#2
|
||||
|
||||
![]()
You could use a Document_Open macro like the following in the 'ThisDocument' module of either your document or its template:
Code:
Sub Document_Open() Application.ScreenUpdating = False Dim StrName As String, StrQty1 As String, StrQty2 As String, StrVal As String StrName = InputBox("What is the name?") StrQty1 = InputBox("How many apples are there?") StrQty2 = InputBox("How many apples do you want?") StrVal = InputBox("How much each are they?") Call UpdateBookmark("Name", StrName) Call UpdateBookmark("Qty1", StrQty1) Call UpdateBookmark("Qty2", StrQty2) Call UpdateBookmark("Price", StrVal) Application.ScreenUpdating = True End Sub Sub UpdateBookmark(StrBkMk As String, StrTxt As String) Dim BkMkRng As Range With ActiveDocument If .Bookmarks.Exists(StrBkMk) Then Set BkMkRng = .Bookmarks(StrBkMk).Range BkMkRng.Text = StrTxt .Bookmarks.Add StrBkMk, BkMkRng End If End With Set BkMkRng = Nothing End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
inputbox, macro, prompt |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
arpirnat | Word VBA | 1 | 04-27-2015 10:03 PM |
Taking input from InputBox from user | SeattleITguy | Excel Programming | 1 | 01-28-2015 09:05 AM |
![]() |
LadyAna | Word | 1 | 12-06-2014 10:39 PM |
VBA to Find and Format Text string defined using Inputbox within selection | sistemalan | Word VBA | 7 | 10-03-2014 07:28 AM |
Modify vba code to print based on name in the InputBox | OTPM | Project | 0 | 05-25-2011 02:03 AM |