|
-
May 23rd, 2006, 12:31 PM
#1
Thread Starter
Addicted Member
RESOLVED[Userform1 to userform2]
I have 2 userforms. In userform1 I entered some data through a combobox and stored it in a variable defined as a string. Then from userform1, once you've finished filling it, you pass to userform2.
How can you bring to userform2 the data from the combobox in userform1 stored in that variable?
Last edited by Fonty; May 23rd, 2006 at 02:58 PM.
-
May 23rd, 2006, 12:52 PM
#2
Re: Userform1 to userform2
Place the variable declaration in a Module. Make it Public blah As String and it will be afvauilable to any userform or sheet.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 23rd, 2006, 01:21 PM
#3
Thread Starter
Addicted Member
Re: Userform1 to userform2
I created a module with:
VB Code:
Sub region()
Public region As String
End Sub
However, when I put in the userform
it happens to be an error. What am I doing wrong?
-
May 23rd, 2006, 01:32 PM
#4
Re: Userform1 to userform2
Should be like this ...
VB Code:
Option Explicit
Public strRegion As String
Then to use anywhere:
VB Code:
Private Sub Command1_Click()
strRegion = "West Side!"
MsgBox strRegion
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 23rd, 2006, 01:43 PM
#5
Thread Starter
Addicted Member
Re: Userform1 to userform2
Sorry... I still don't get it. Where do I write Option Explicit?
-
May 23rd, 2006, 01:45 PM
#6
Re: Userform1 to userform2
In a new standard Module. You can add it to your project if you dont have one by right clicking on the project file in the VBA IDE Project explorer and selecting Insert Module.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|