Using Marcobutton NoMacro to replace text

K

Karen

Hi,

I'm creating a template and using the Macrobutton NoMacro function to let
users know what they have to include in a document and where. This works fine
for short items (such as Macrobutton NoMacro Type in the document title) but,
if the text I wish to include goes over 1 line or is larger than a column in
a table, I get an error (DisplayText cannot span more than one line)

I don't want to use Text Form fields as this would mean I would have to set
up all text in the document as a Text field and user would not be able to add
extra "bits" (when a form is locked, the cursor will only move to the next or
previous fields).

Any suggestions please (I'm using Word 2000)?
 
M

macropod

Hi Karen,

With the MACROBUTTON approach, you prompt text cannot span more than one line. The text input by the user can, however.
 
G

Graham Mayor

You could run a macro from the macrobutton field, but then you would have
the problem of ensuring users allowed your macro to run. Something like

Sub tInput()
Dim oRng As Range
Set oRng = Selection.Range
oRng = InputBox("This is a prompt" & vbCr & _
"which can use a number of lines" & vbCr & _
"to convey your instruction", "Enter text")
End Sub

run from the macrobutton field, will replace the field with the text entered
in the input box.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
K

Karen

Thanks but I'm not sure this helps. When it comes to Macros, all I've ever
done is recorded keystrokes (suing Tools, Macro, Record New Macro) and used
the Macrobutten NoMacro facility (which I've only started using in the last
day or so).

It looks like what you've given me is some Visual Basic code and I've no
idea how. to use this.

Looks like I'll have to think of a plan b.

Thanks anyway
 
G

Graham Mayor

http://www.gmayor.com/installing_macro.htm explains what to do with the
code.
The message you wish to pass to the user is

"This is a prompt" & vbCr & _
"which can use a number of lines" & vbCr & _
"to convey your instruction"

which comprises three lines of text in quotes with ' & vbCr & _' as the line
feed
The macro pops up a text input box with the above message and space for the
user to enter the text, which is placed at the macrobutton field position.
The Macrobutton field itself would be { MACROBUTTON tInput Double Click
Here } where Double Click Here is the prompt.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top