View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
divya divya is offline
external usenet poster
 
Posts: 26
Default How to acess form elements values in the Workbook_newsheet event??

Hiiii
1.I have a form which is loaded on workbook_open event.
2.On this form There are two option buttons namely optSI and
optFPS.the user selects one and clicks Ok button
3.Now the onClick event for OK has following code
Public fps, si As Integer ' I want to know scope of
these variables
Private Sub CmdOK_Click()
If OptFPS Then
fps=1
Sheets.Add
ElseIf optSI Then
Sheets.Add
si = 1
End If
Unload Me
End Sub
4. Now when a sheet is added I want to
1. call convertmkstofps if optfps is selected
2 call convertmkstosi if optsi is selected

How can we do this??What I did is
I wrote followinfg code in the Workbook_newsheet event

Private Sub Workbook_NewSheet(ByVal Sh As Object)
If fps = 1 Then
Call convertmkstofps
ElseIf si = 1 Then
Call convertmkstosi
End If
End Sub

But this doesn't seem to work,I tried to display fps and si in
message box it doesn't show any value.
I have declared these values as public as u see in Note 3 above the
command button click event,then too its scope is limited only till the
form.

Plzz tell me how do I do this,I mean access (optfps and optsi) values
or (fps and si )in the Workbook_NewSheet(ByVal Sh As Object) event

Regards
Divya