View Single Post
 
Old 08-23-2021, 04:26 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,159
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Which line is the error occurring on? That will make it easier to diagnose.

My observations are:
1. It is unusual to unload the userform and then expect the rest of the code to proceed since that code is inside the userform. I would recommend you remove that line from the Beta macro and put it at the end of the cmdYes_Click macro. Or better still, put it in the macro that called the userform in the first place. I use Me.Hide at the end of macros when I want to get rid of the userform. This allows the code to run to completion.
2. Application.Templates(ActiveDocument.AttachedTempl ate.FullName). is overly indirect. Try this instead ActiveDocument.AttachedTemplate.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote