How to close window forcefully
Hi Specialist:
I try to close window forcefully without considering the prompt window of save or not. However, the macro below can not realize this. Could you please direct me how to revise? Thank you.


I try to close window forcefully without considering the prompt window of save or not. However, the macro below can not realize this. Could you please direct me how to revise? Thank you.

Tagged:
0
Answers
-
Hi Friends:
I have solved it, just share the code. Thank you.Public _windows As McWindows
_windows = ThisApplication.Windows _windows.CloseAll(True)0 -
2022-02-14-143516StanleyH --Below is another way to perform a CLOSE ALL IMAGE WINDOWS without a prompt to the USERI hope this is helpful.-- Matt-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*'CLOSE ALL OPEN IMAGES WITHOUT PROMPTING THE USER
CloseAllForm.ClosingAllAction=CloseAllForm.CloseAllFormAction.actionNoAll
ThisApplication.Windows.CloseAll()
0 -
Hi Matt:
Thanks for your code, it also works.0 -
Just share the post link to someone that needs:
https://forums.mediacy.com/discussion/258/how-do-i-write-a-macro-to-close-all-open-images-without-user-prompt
0 -
2022-02-15-093338StanleyH --Thank you for locating and posting the link to that POST.You might also consider putting your own PROMPT in front of your CLOSE ALL. Maybe something like what I have used in the past.I hope this is helpful.-- Matt-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
'Determine the number of open documents
Dim MyNumberOfDocuments
MyNumberOfDocuments = ThisApplication.Documents.Values.Count
'If there are any images open
If ( MyNumberOfDocuments > 0 ) Then
'Then
'Give the user an appropriate prompt
If (MsgBox _
( _
"There are images open within IMAGE-PRO PREMIER." & vbLf & vbLf & _
"This program is designed to work with only its images open." & vbLf & vbLf & _
"Please press YES to CLOSE ALL IMAGES or press NO to leave the images open.", _
vbYesNo, _
"'textBox_WorkingFolder_DoubleClick' says . . ." _
) = vbYes) Then
'Close all open images without prompting user
CloseAllForm.ClosingAllAction=CloseAllForm.CloseAllFormAction.actionNoAll
ThisApplication.Windows.CloseAll()
End If
End If
0 -
Hi Matt:
Thanks for your solution, I have read a lot of posts sent by you and it helped a lot.0 -
2022-02-16-122809StanleyH --Super.Thanks.-- Matt
0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions