G
Guest
Hello,
I would like to create a clean code without using many global variables and
so on and I ran into a problem.
I would like to create a function that returns an Excel.Sheet. The parametr
for the function is a workbook object that is opened previously.
I would like to open a form that loads the sheets into a listbox (the form
should be a dialog) and after the user selects one the form closes and
returns value back to the function, which returns the sheet.
When I create the form and call the function
Private Function GetSheet(W As workbook)
Dim f As Form_frmSheetChoice
Set f = New Form_frmSheetChoice
'property of the Form_frmSheerChoice that should be used on the activate event
Set f.SetWorkbook = W
f.lstSheets.SetFocus
MsgBox "pause"
End Function
I can see the form got opened but it didn't gain focus at all. If I do not
use the msgbox the function just passes by.
How can I set focus to the form ?
Any suggestions are welcome.
Thank You.
I would like to create a clean code without using many global variables and
so on and I ran into a problem.
I would like to create a function that returns an Excel.Sheet. The parametr
for the function is a workbook object that is opened previously.
I would like to open a form that loads the sheets into a listbox (the form
should be a dialog) and after the user selects one the form closes and
returns value back to the function, which returns the sheet.
When I create the form and call the function
Private Function GetSheet(W As workbook)
Dim f As Form_frmSheetChoice
Set f = New Form_frmSheetChoice
'property of the Form_frmSheerChoice that should be used on the activate event
Set f.SetWorkbook = W
f.lstSheets.SetFocus
MsgBox "pause"
End Function
I can see the form got opened but it didn't gain focus at all. If I do not
use the msgbox the function just passes by.
How can I set focus to the form ?
Any suggestions are welcome.
Thank You.