need some help on inputbox's

Konnan
08-06-2001, 03:23 PM
hey im new to this whole vb and VBA im trying to create what should be a simple inputbox in a macro in word 2000 and just cant get it to work does anyone know what the santax is???

thanks
Konnan

Thinker
08-06-2001, 03:30 PM
Some how I doubt this is what you are asking but here goes.
In the Code Pane for ThisDocument I added
<pre>
Public Sub TestInput()
Dim strAnswer as String

strAnswer = InputBox("Tell me the answer","Question","Answer here")
MsgBox "You answered " & strAnswer
End Sub
</pre>
When I run it, it opens an inputbox. I write something in the box and
click OK. It displays what I typed.

I think therefore I am... sometimes right. images/icons/wink.gif

Thinker
08-06-2001, 03:42 PM
It would help if you posted the code you typed in. I already tested this so the problem could be that you didn't type it in the same way.


I think therefore I am... sometimes right. images/icons/wink.gif

Konnan
08-06-2001, 03:45 PM
' conan Macro
' Macro created 8/7/2001 by Ryan

Public Sub TestInput()
Dim strAnswer As String

strAnswer = inputbox("Tell me the answer", "Question", "Answer here")
MsgBox "You answered " & strAnswer
End Sub

this is what i have in my code

Thinker
08-06-2001, 04:09 PM
I just tested it again. What I did was to select macro from the Tools menu. On the macro menu I selected Macros. A box appeared for Macro name: I entered TestInput and clicked create. In the code pane that opened I added these three lines inside the Sub-End Sub area.

Dim strAnswer as String
strAnswer = InputBox("Tell me the answer", "Question", "Answer here")
MsgBox "You answered " & strAnswer

I then pressed the F5 key and the box appeared with Question as the heading and a textbox with Answer here highlighted. I click OK and a messagebox appears with Microsoft Word as the heading and "You answered Answer here" in the box and a OK button.

I am also using word2000. If you can't duplicate this then I am sorry, I don't know what to tell you.

I think therefore I am... sometimes right. images/icons/wink.gif

Konnan
08-06-2001, 04:22 PM
Thnaks dude it worked this time

thanks a lot

Thinker
08-06-2001, 04:25 PM
Great! And thanks for posting back to say you figured it out.

I think therefore I am... sometimes right. images/icons/wink.gif

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum