| タイトル | : Re^4: VBAで開いたエクセルを、保存しないで閉じたい |
| 記事No | : 15669 |
| 投稿日 | : 2010/09/02(Thu) 15:14 |
| 投稿者 | : Hank |
こんなのはどうですか?
' ExcelBookを開かずに、すでに開いているかどうかを調べる。 Dim WD, task, Exl Exl = CreateObject("Scripting.FileSystemObject").GetBaseName(sExcelPath)
Set WD = CreateObject("Word.Application") For Each task In WD.Tasks If task.Visible = True And InStr(1, task.Name, Exl) Then MsgBox Exl & "は、開いています。" Exit For End If Next WD.Quit: Set WD = Nothing 'MS Word が、インストールされていること。
|