LoginSignup
0

More than 5 years have passed since last update.

Meryマクロで開いているファイルを削除する

Posted at
  • 現在開いているファイルを削除するマクロです
    • 開いているドキュメントがファイルでない場合は警告を表示して終了します
    • 削除したウィンドウを閉じます
DeleteFile.js
#title="開いているファイルを削除する"

var fso = new ActiveXObject('Scripting.FileSystemObject');

var fullPath = Document.FullName;
if(fullPath == "") {
    alert("ファイルを開いていません")
    Quit();
}

var file = fso.GetFile(fullPath);
alert(file + "を削除しました");
fso.DeleteFile(file);;
Editor.ActiveDocument.close();

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0