I have a Add-in installation macro. In order to install it correctly,
all other workbooks need to be closed. My installation macro checks for
that using this code...
' check for open workbooks
' ------------------------
If Workbooks.Count > 1 Then
MsgBox "Before installing this Add-in you have to close all other
workbooks."
For Each WB In Workbooks
If WB.Name <> ThisWorkbook.Name Then
If WB.Saved Then WB.Close
End If
Next WB
End If
(note: WB is a public variable defined "As Workbook
BUT... it only works when the workbooks are in the same Excel session.
How can I check if a user has a second (or even third, fourth) Excel
session open? And how can I check for workbooks in those additional
sessions and close them?
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar