Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

macro to open a form from excel

Status
Not open for further replies.

idono

Technical User
Jan 16, 2002
71
US
Alright I have had it! I'm trying to open a form with a macro within Excel.

frmMain.show vbmodal

I get an error that says "object doesn't support this property or method". Am I missing a library? Any suggestions.
 
Hi,
So, in your VBA Project, where your macro is to show frmMain, you ALSO have a UserForm that you have named frmMain? Skip,
metzgsk@voughtaircraft.com
 
That is correct Skip. But I'm finding out that the thing is erroring out because some of the form code is bad, not the call to the form. I just need to get my form code straight and it should fly.

Thanks,
Doug
 
Well, the only thing, I think, that would cause that kind of message, is if the form were named something else OR frmMain were defined as some other kind of object. Skip,
metzgsk@voughtaircraft.com
 
I got your error with this code...
Code:
    Dim frmMain As UserForm
    Set frmMain = UserForm1
    frmMain.Show vbModal
Does your code look something like this? Skip,
metzgsk@voughtaircraft.com
 
You do not have any options available to the Form.Show method in VBA. This is only available in VB.

It should simply be:
frmMain.Show

Hope this helps.
 
The only line in the macro is:
frmMain.show vbModal

After sending out the call for help I started looking closer with the debugger. I found that the control was indeed being passed to the form. I inserted an error handling function and the error is within the form_initialization procedure. I think it is odd the error showed up before the form, but that was the case. And when I chose to debug the problem the frmMain.show vbModal was highlighted so I assumed that was the error.

Thanks,
Doug
 
dsi,
The Show method for Userform DOES have, as an optional argument, vbModal or vbModeless, so THAT is not the problem. :) Skip,
metzgsk@voughtaircraft.com
 
Are you using Excel 97 ? If so vbModal has no meaning because Office 97 forms cannot be shown modelees (at least not via VBA) and so th eoption does not exist.

Just use frmMain.show , it's the ame thing anyway.

AC
 
Thanks acron! I should have specified which version I was referring to. Skip, has this changed in newer versions?
 
dsi,
Since I don't have a copy of 97 on my machine, I can only state that modality is an optional argument in Excel 2000. :) Skip,
metzgsk@voughtaircraft.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top