Using a Userform's textbox value as a global variable

M

mcwhirt3

Hi,

I'm creating a Publisher 2003 add-in using Visual Basic 6. I have a
userform(form1) and 2 textboxes on this form(textbox1, and textbox2).
In textbox1 the name of a printer will be entered and in textbox2 the
path to a folder will be entered. The text entered then needs to be
used throughout the rest of the project as a global variable. I have an
"ok" button on the page, and I have tried triggering this code with it:

Private Sub Command1_Click()
Public Const myVariable As String = Form1.Text1.Text
Public Const myVariable2 As String = Form1.Text2.Text
End Sub

I know that global variables must be declared in seperate modules, not
on userforms so I knew this wouldn't work. I've read some other posts
that talk about setting the textboxes datasource property to a
subroutine but the examples i've tried have not worked for me. Any help
would be greatly appreciated!
 

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

Similar Threads


Top