Word vba open template as document




















The procedure can be stored in the ThisDocument class module of a document or its attached template. Have questions or feedback about Office VBA or this documentation?

Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback. Skip to main content. This browser is no longer supported. Download Microsoft Edge More info. Fields "Field3". The problem occurs on the "set db" line.

Since MyDatabase was used to open the New Word document. It is still open and running that code. The error message says 'The database is in a state by user [machine name].

The database is locked. Thank you for the link to Allen Browne's GoHyperlink. However, since the issue I'm having is not with the structure of the the path and file name this will not solve my issue. I split the database and this allowed me to run the code of the Word UserForm. However, I had some complaints about using the Front End and keeping it up to date. I will try also to open the Word Template as a new document from either a Windows application or another Access Database and then open Main database after all code in the Word document is finished running.

This will eliminate the problem of code running in the database I will need to open. This is yet again one more reason why is it a best practice even for a single user database. I wish I understood better your problem, because I have done tons of automation Word, Excel, Outlook and have never had to resort to such conveluted techniques, and have never experienced locked databases as you described. This is very odd. It is merely a way to open a file and a very good one at that.

As my teacher always said, "There is more than one way to skin a cat. The issue with the users was the front end and they were happy and satisfied with my solution. I am not having a problem with errors when opening the link. It is just not giving me the desired results, a new document instead of the template. Nevertheless, I am not trying to win arguments.

Open "file name here" With wDoc. Improve this question. Brian Brian 2 2 gold badges 16 16 silver badges 30 30 bronze badges. Add a comment. Active Oldest Votes. Improve this answer. Valiante Valiante 1, 1 1 gold badge 9 9 silver badges 13 13 bronze badges. Also, remember to turn the alerts back on With wDoc. Sign up or log in Sign up using Google. Sign up using Facebook.

Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science.



0コメント

  • 1000 / 1000