View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Alan[_2_] Alan[_2_] is offline
external usenet poster
 
Posts: 116
Default Accessing Excel 2007 Userforms from Macros

Hopefully, someone with Excel 2007 will step in and help out. We are behind
the times, 2002. I did look around a bit for you. Maybe you will find
something to help you he

"Brad Wylie" wrote in message
...
Alan,

There really wasn't much code to post other than the statement which I put
in my original note. The code is posted below and some additional
information I have uncovered since the original post.

When the workbook opens it makes the call to show the form and generates
the
error I noted "subscript out of range". It appears somehow when the old
.xls
workbook is resaved in the new native Excel 2007 .xlsm format the
worksheet
macros are unable to find the form code. The references are lost. I have
found that if you delete all the forms from the .xlsm workbook and then
recreate them along with thier associated code everything works fine.
However if this what one must do to convert old Excel programs with VBA
forms
code to the new format they just may stay in the old format.

Private Sub Workbook_Open()

MsgBox "Do you want to run payroll now?", vbYesNo, "This Workbook
Coding"
If vbYes Then
frmPayrollForm.Show
MainPayrollModule 'call Main module to finish processing &
reporting
End If
' Initially place us on the Actual sheet at the top
Sheets("Actual").Select
Range("C4").Select


End Sub

--
Brad Wylie


"Alan" wrote:

You will get faster and better results if you post your code.

Regards,

Alan

"Brad Wylie" wrote in message
...
In Excel 2003 I could access my user form from the macro running in an
an
Excel worksheet using frmPayrollForm.show. In Excel 2007 this same
statement
creates a "subscript out of range" error message. Also when accessing
subroutines in the userform code from the macro it creates an error
message
"sub or function not defined" error message. The form has to be
accessed
from the spreadsheet to start so how does Excel 2007 link these two
folders
together so the form is accessable.
--
Brad Wylie