Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word VBA

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 07-12-2018, 01:33 PM
LimpingBuf LimpingBuf is offline Windows 10 Office 2016
Novice
 
Join Date: Feb 2007
Posts: 3
LimpingBuf
Send a message via AIM to LimpingBuf Send a message via MSN to LimpingBuf Send a message via Yahoo to LimpingBuf
Default Showing userform in document open results in error message

This should be easy but I can't make it work. I would like to distribute to outside clients templates of various contracts we have created for them. I have created a template (call it the "parent template") that holds a form that populates a list box with the template names and allows the user to select a template and create a new contract based on the selected template.

The form itself works fine when activated from a macro when the parent template is open. However, when I try to open the form using the document open event based in the parent template, I get a message saying:

"You cannot close Microsoft Word because a dialog box is open. Click ok, switch to Word, and then close the dialog box."



Either X'ing out or clicking on ok puts me into the form and everything works fine from that point in.

The other point to be aware of that may be a factor is that after the new document is created, the form is closed and the parent template is closed.

I use a similar system to allow people within my firm to access contract templates and it works quite well. However, in our firm we distribute a parent template that is loaded into word at startup. A macro is installed on the user's toolbar and that activates and shows the selection form. Unlike the client project, our internal project does not close the parent template.

A long winded question, but hopefully that gives you an idea of what I trying to do. I suspect that there is an easy fix, but i can't find it.
Reply With Quote
  #2  
Old 07-12-2018, 07:58 PM
Guessed's Avatar
Guessed Guessed is online now Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 764
Guessed is on a distinguished road
Default

I think you have two choices:
1. Distribute the addin to the clients and help them install it in their startup folder
2. Bring all the "contracts" into a single template (by saving each as a quick part) then either:
- teach the users how to select the relevant contract from the quick parts
- add a startup macro that displays a userform which lists the available quick parts and lets them choose one to insert.

I would normally do the second option because I don't like having progressively bigger and bigger sets of files where minor edits need to be repeated in all the files.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 07-13-2018, 07:28 AM
LimpingBuf LimpingBuf is offline Windows 10 Office 2016
Novice
 
Join Date: Feb 2007
Posts: 3
LimpingBuf
Send a message via AIM to LimpingBuf Send a message via MSN to LimpingBuf Send a message via Yahoo to LimpingBuf
Default

Thank you for the response.


Essentially what I am doing is what you suggested as option number 2. I have a userform that I want to load at start up. The startup procedure is simply to show the userform. MS Word won't let the form load. If the user simply clicks thru the message about not being able to close word, the useform loads and it works fine. Is there some trick to showing userforms at startup?

Thanks for the help.
Reply With Quote
  #4  
Old 07-13-2018, 06:42 PM
Guessed's Avatar
Guessed Guessed is online now Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 764
Guessed is on a distinguished road
Default

I think you missed the point of what I was saying. My #2 method is not opening two documents and closing one. It is just opening one document. This would mean there doesn't need to be a parent template which opens a secondary template.

Showing a userform at startup is pretty simple, just name the macro that calls it either AutoOpen or AutoNew depending on whether you want to see it every time you open the doc or just when you are creating a new file.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error message when trying to open excel file Glenda Excel 1 08-03-2015 07:12 AM
Error message opening a document in Word "Word cannot open this file because it is larger than 512 M poonamshedge Word 2 09-11-2014 06:11 AM
Change focus from userForm back to word document to see results. Hank Smith Word VBA 1 08-11-2014 05:00 AM
Automation error Unknown error" message once they open the Excel file hlina Excel 1 10-08-2013 09:14 PM
Repair command results in error message srdiamond Office 0 03-01-2011 12:13 PM


All times are GMT -7. The time now is 05:20 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft