PDA

View Full Version : VBA Interactive User Prompt



Corky
06-27-2011, 06:33 PM
I am new to coding with VBA. I am looking for help, if there is a way, to write an interactive user propmt command box. I would like this box to appear with a question that the user has to input something; e.g. a numeric value or verbage. The user would then continue there reading of the document until the next section/page is visible. Again another user prompt would appear requesting an input of some sort. Is this possible to do in visual basic?

Any support is greatly appreciated.

gmaxey
06-27-2011, 08:59 PM
Basically you would use an InputBox

Sub ScratchMacro()
'A quick macro scratch pad created by Greg Maxey
Dim pStr As String
pStr = InputBox("Please enter your name.", "NAME")
MsgBox "Thank you " & pStr & " for giving your name.", vbExclamation + vbOKOnly
End Sub


The issue is a suitable event to initiate procedure. There is no "I'm reading the document and just started reading a new page" event. You might experiment with the selection change event but I think that only fires when you physically use the mouse or keyboard to change the selection.