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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem inserting new userform in old WordBasic template

Status
Not open for further replies.

be17

Technical User
Feb 7, 2001
26
US
I am working with an old Word template created by someone else years ago using Word Basic. I need to make some modifications to the template, including a new userform I created (with VBA) that I need to call up at the end of the existing AutoNew module (which is written in Word Basic) but my usual methods for loading/showing a userform aren't working. What code should I be using to bring up the new userform I have created? Simply using frmEpicDocType.Show doesn't seem to work, even though that code works with all of my newer templates created with VBA. Is it not possible to call up a new userform from previously created Word Basic module?

be17
 
Yeeech, bleeech. Mixing old WordBasic and new VBA stuff is a pain.

If you have a newer version userform, does this mean you are in fact using a newer version of Word? If so, if would be far better to recreate the old template.

Gerry
My paintings and sculpture
 
Yes, I am using Word 2003. But the original template is quite complicated and right now I don't have the time to recreate it, although I know that is the best solution, so I need a quick fix to simply be able to load/show a new form.
 
It is within the AutoNew module that I need to show the new userform, and at the bottom of the AutoNew module I have inserted frmEpicDocType.Show, but it always debugs to that line of code, saying, Run-time error '424', Object required. Any suggestions? What does object required mean? I have double checked and frmEpicDocType does exist and the form is named exactly the way I am trying to call it up.
 
And the userform is actually IN this document?

Can you display the userform in design mode?

Just to be clear, this old template file is being opened in 2003?

Gerry
My paintings and sculpture
 
The new userform is actually in the template, the same template that has the AutoNew module I'm working with. And yes, this old template/Word Basic code is being opened in Word 2003 and works just fine, but I can't get it to show this new userform. By design mode, do you mean in VBA, just clicking on Run? I can view the actual userform in design mode by clicking on frmEpicDocType in the Project Explorer, but when I click Run to get the AutoNew code to run, I get the Object required error.
 
I just figured out that it must have something to do with my code that I put in the frmEpicDocType, because when I take all of the code out and simply have the userform with no code, then I can run the frmEpicDocType and it comes up just fine. What I can't figure out is, why then would it error out at the AutoNew frmEpicDocType line of code, rather than somewhere inside the code for the userform?



 
Put a Stop statement in your UserForm's code and then step it to discover where the error is raised.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks. Everything is working now. It was easy to find my problem (an extra period) once I figured out that the problem was in the userform code, rather than in the frmEpicDocType.Show code in my AutoNew.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top