Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WORD VBA - Forms

Status
Not open for further replies.

rossmcl

Programmer
Apr 18, 2000
128
Hi.

I am using a form in Word. Want to take a value from a textbox (lets call it variable A, and use that in a module behind the on-click of a button on the form.

It is fine if I use the variable A in the on_click procedure. How do I use it in a function called during the on_click procedure.

Is there any examples of this that someone has. This should be simple but I cant see what I am doing wrong.

eg

Option Explicit

Public a As String

Public Sub CommandButton1_Click()

a = Me.TextBox1.Value

TableCreate

End Sub



What syntax do I have to put in TableCreate to 'grab' this value?




 
Hi,

Ive not tested this but have you tried this ?
(Assuming TableCreate is a sub or function)

Option Explicit

Public Sub CommandButton1_Click()

TableCreate(cstr(Me.TextBox1.Value))

End Sub

Public sub TableCreate(ByVal a as string)

Do stuff here e.g debug.print "Passed string: " & a

End Sub



Missy Ed
Looking to exchange ideas and tips on VB and MS Access development as well as office 97 development. Drop me a line: msedbbw@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top