Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default userforms / worksheets

i am writing a help system for my vba/excel project
the help is launched from a button on each worksheet in the workbook
each button calls the same help system

the help is built with a userform and a multi-page

how do i detect which worksheet the help was launched from in order to set
the mult-page to the correct page?

ie if the user is on 'sheet 2' and they click the help button, the help will
come up and display 'page 2'

tia

J
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default userforms / worksheets

ActiveSheet.name will give you the name of worksheet. I assume the HELP
button on the worksheet is attached to a macro which invokes the Help
Userform so you will have name available to you.

e.g. hlpSheet=Activeworksheet.Name

HTH

"Gixxer_J_97" wrote:

i am writing a help system for my vba/excel project
the help is launched from a button on each worksheet in the workbook
each button calls the same help system

the help is built with a userform and a multi-page

how do i detect which worksheet the help was launched from in order to set
the mult-page to the correct page?

ie if the user is on 'sheet 2' and they click the help button, the help will
come up and display 'page 2'

tia

J

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default userforms / worksheets

Test for ActiveSheet.Name, like so:

Select Case ActiveSheet.Name
Case "Sheet1"
'calls up help for Sheet1
Case "Sheet2"
'calls up help for Sheet2
..
..
..

End Select

"Gixxer_J_97" wrote:

i am writing a help system for my vba/excel project
the help is launched from a button on each worksheet in the workbook
each button calls the same help system

the help is built with a userform and a multi-page

how do i detect which worksheet the help was launched from in order to set
the mult-page to the correct page?

ie if the user is on 'sheet 2' and they click the help button, the help will
come up and display 'page 2'

tia

J

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default userforms / worksheets

Hi J

That depends. Is Sheet 2 the second sheet from the left ? If so

Select Case ActiveSheet.Index
Case 2
MsgBox "Yo"
Case Else
'...

Ensure that users can't move, delete, insert sheets if so.
If Sheet 2 is the sheet name then

Select Case ActiveSheet.Name
Case "Sheet 2"
MsgBox "Yo"
Case Else
'...

Ensure that users can't rename the sheets if so.
Then you have code names (=name in the project explorer, like Sheet2). But
maybe there's an even better identifier or way to do this ?

HTH. Best wishes Harald

"Gixxer_J_97" skrev i melding
...
i am writing a help system for my vba/excel project
the help is launched from a button on each worksheet in the workbook
each button calls the same help system

the help is built with a userform and a multi-page

how do i detect which worksheet the help was launched from in order to set
the mult-page to the correct page?

ie if the user is on 'sheet 2' and they click the help button, the help

will
come up and display 'page 2'

tia

J



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default userforms / worksheets

thanks to all! some great ideas to work with!
i'ld like to keep it as dynamic as possible so if in the future i need to
add another sheet (or move sheets around) i won't have to re-code everything.

J

"Harald Staff" wrote:

Hi J

That depends. Is Sheet 2 the second sheet from the left ? If so

Select Case ActiveSheet.Index
Case 2
MsgBox "Yo"
Case Else
'...

Ensure that users can't move, delete, insert sheets if so.
If Sheet 2 is the sheet name then

Select Case ActiveSheet.Name
Case "Sheet 2"
MsgBox "Yo"
Case Else
'...

Ensure that users can't rename the sheets if so.
Then you have code names (=name in the project explorer, like Sheet2). But
maybe there's an even better identifier or way to do this ?

HTH. Best wishes Harald

"Gixxer_J_97" skrev i melding
...
i am writing a help system for my vba/excel project
the help is launched from a button on each worksheet in the workbook
each button calls the same help system

the help is built with a userform and a multi-page

how do i detect which worksheet the help was launched from in order to set
the mult-page to the correct page?

ie if the user is on 'sheet 2' and they click the help button, the help

will
come up and display 'page 2'

tia

J






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default userforms / worksheets

Hi,
You could try this code.

Sub myHelp()
mysheet = ActiveSheet.Name
Select Case mysheet
Case Is = "Sheet1"
UserForm1.MultiPage1.Value = 0
UserForm1.Show
Case Is = "Sheet2"
UserForm1.MultiPage1.Value = 1
UserForm1.Show
End Select
End Sub

Regards,
Julian
http://www.angelfire.com/biz7/julian...ans_macros.htm

i am writing a help system for my vba/excel project
the help is launched from a button on each worksheet in the workbook
each button calls the same help system

the help is built with a userform and a multi-page

how do i detect which worksheet the help was launched from in order to set
the mult-page to the correct page?

ie if the user is on 'sheet 2' and they click the help button, the help will
come up and display 'page 2'

tia

J

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
userforms Fretsa Excel Programming 1 July 27th 04 12:52 AM
UserForms soniya Excel Programming 1 April 11th 04 11:14 AM
userforms Dave[_27_] Excel Programming 1 August 28th 03 06:25 PM
Userforms Gary[_8_] Excel Programming 1 August 18th 03 03:26 PM
Userforms Henry[_4_] Excel Programming 0 August 9th 03 11:37 PM


All times are GMT +1. The time now is 02:48 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"