PDA

View Full Version : [SOLVED:] Userform to only open and run once.



Aaronjames
10-16-2017, 12:07 AM
Hi all,

I am realativly new to VBA (self taught from google and youtube).

I have created a userform that completes my documents. The document is saved on a sharepoint site. People will open the document, complete/run the userform to create the document (via bookmarks) and then save it. However, if they click on their document again the userform pops back up (and as most of the document bookmarks have been deleted, the userform won't run again). Is there a way that once the userform has run it won't come up again if the same document is opened?
I also tried toying with the idea of once the userform has run, to force a 'save as' to save as a docx. Instead of a docm. File. However I'm not that skilled with the coding to figure out how to do this.

thanks in advance for any assistance :)

macropod
10-16-2017, 02:01 AM
You should save your document as a macro-enabled (dotm) template with a Document_New macro to load the userform. Any documents thus created will default to the docx format, yet will have the userformat auto-load only when the document is created.

Aaronjames
10-28-2017, 10:52 PM
Hi Paul,

Sorry about the late reply.

Thanks so much for the above! Exactly what i wanted.

Aaron