![]() |
#1
|
|||
|
|||
![]()
Hi,
This macro works closes the document fine except when initiated from a command button on a userform. Can someone help me figure out why and what I need to do to get it to work, please? Macro: Sub CloseDontSave() Word.ActiveDocument.Close wdDoNotSaveChanges End Sub I have a command button on the doc that runs it and that's fine. I've created an AutoClose macro to show a userform if the user does not click any of the buttons provided. One of the buttons on the userform is also set to run this macro but bugs out when closing the doc. ![]() Private Sub CommandButton3_Click() UserForm2.Hide Application.Run MacroName:="CloseDontSave" End Sub This is the error I get: Run-time error '-2147352567 (80020009)': Method 'Run' of object '_Application' failed |
#2
|
|||
|
|||
![]()
Ugh, never mind, that was dumb. It's bugging out on close because it was already in the process of closing.
I changed the macro to this and it's good to go: Sub CloseDontSave() ActiveDocument.Saved = True End Sub |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
webharvest | Word VBA | 1 | 06-29-2011 04:56 PM |
![]() |
MShroff | Word VBA | 4 | 04-05-2011 09:00 PM |
![]() |
cksm4 | Word VBA | 7 | 02-27-2011 08:47 PM |
Button click event from a noob | jsampson | Outlook | 0 | 10-12-2010 01:48 PM |
Add-In:How to add command right click command bar | phang | Outlook | 0 | 01-15-2007 02:53 AM |