Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Word, PowerPoint, Outlook, and Other Office Products > Userform Name


Reply
 
Thread Tools Display Modes
  #1  
Old 06-25-2003, 04:30 AM
Marcs's Avatar
Marcs Marcs is offline
Centurion
 
Join Date: Mar 2003
Location: Germany
Posts: 131
Default Userform Name


hi
i wonder if there is a way to get the name of the active userform in another macro
i have a userform and when i click a commandbutton it runs a macro(application.run)
this macro adds a new sheet and i want the sheets name to be the name of the userform but i dont get it
i think i have to make the name of the userform public so that the macro can use the variable
or get the userforms name with the macro code but i cant
any solutions?
__________________
Ater Sanguis is watching you - and the Wisdom of the Dragon helps him!
Reply With Quote
  #2  
Old 06-25-2003, 08:13 AM
Timbo's Avatar
Timbo Timbo is offline
Green-Eyed

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Bangkok, Thailand
Posts: 10,261
Default

strNewWorksheetName = Me.Name
__________________
"He's not the Messiah. He's a very naughty boy!" - Brian's mum

Can't find the answer? >> Try something new!
Become a Professional
Reply With Quote
  #3  
Old 06-25-2003, 10:53 AM
Marcs's Avatar
Marcs Marcs is offline
Centurion
 
Join Date: Mar 2003
Location: Germany
Posts: 131
Default

thanx for your reply timbo
but its not what im looking for
the new sheet (added from a macro in a modul) should have the name of the Form
and because its a seperate macro the variables defined by the form are deleted and the form is inactive so that i cant use Me
__________________
Ater Sanguis is watching you - and the Wisdom of the Dragon helps him!
Reply With Quote
  #4  
Old 06-26-2003, 07:03 AM
Timbo's Avatar
Timbo Timbo is offline
Green-Eyed

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Bangkok, Thailand
Posts: 10,261
Default

If the procedure is launched from a command button on the form, you can pass the variable to it. Look up the 'Sub' statement in your VB Help...
__________________
"He's not the Messiah. He's a very naughty boy!" - Brian's mum

Can't find the answer? >> Try something new!
Become a Professional
Reply With Quote
  #5  
Old 06-26-2003, 08:06 AM
Marcs's Avatar
Marcs Marcs is offline
Centurion
 
Join Date: Mar 2003
Location: Germany
Posts: 131
Default

Quote:
Originally Posted by Timbo
If the procedure is launched from a command button on the form, you can pass the variable to it. Look up the 'Sub' statement in your VB Help...



ive looked there but i saw nothing helpful
i try to describe my problem a better way


i have a userform with a commadbutton
if i click on the commandbutton
a procedure is been launched
(to insert several data into a sheet)
and this sheet has to be created first
this should happen by a macro (in a modul[like you use the macrorecorder])
and this macro is launched by a line in the procedure
(with Application.Run "macro")
and because of this i cannot use the variables i define in the procedure
and i cannot access the userform from the macro
but i need the name of the userform because the new sheet should have the same

hope it is more clearly
__________________
Ater Sanguis is watching you - and the Wisdom of the Dragon helps him!
Reply With Quote
  #6  
Old 06-27-2003, 02:56 PM
MJMJ MJMJ is offline
Newcomer
 
Join Date: May 2003
Location: Iowa, USA
Posts: 9
Default

This might work--
Before you run the macro, open the new application and set the caption of the application window with the same name as the form.
Then in the macro you call, use application.caption to get the name.

or, open the application and create and name a new document or worksheet before running the macro in that application.

-MJMJ
Reply With Quote
  #7  
Old 06-28-2003, 04:02 AM
Marcs's Avatar
Marcs Marcs is offline
Centurion
 
Join Date: Mar 2003
Location: Germany
Posts: 131
Default

its a bit long winded but it works
thanx mjmj
__________________
Ater Sanguis is watching you - and the Wisdom of the Dragon helps him!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Initial values in userform from bookmarks carina Word, PowerPoint, Outlook, and Other Office Products 0 06-17-2003 09:17 AM
Taking over a filename to a userform Artifi Excel 0 03-28-2003 07:59 AM
Two game plays selection on one userform rip Word, PowerPoint, Outlook, and Other Office Products 9 02-09-2003 09:00 AM
Unload of userform rip Word, PowerPoint, Outlook, and Other Office Products 10 01-08-2003 07:18 AM
UserForm Word/VB CS1 Word, PowerPoint, Outlook, and Other Office Products 2 07-13-2002 03:08 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->