0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VBAで今開いているエクセルのファイル名(ブック名)を取得する

Posted at

アクティブのエクセルのファイル名を取得して、メッセージボックスに表示するマクロです。

Sub GetFileName()
    Dim FileName As String
    FileName = ActiveWorkbook.Name 'ActiceWorkbookオブジェクトのName情報を取得し、変数「FileName」に格納する
    MsgBox FileName 'FileNameに格納されている文字列をメッセージボックスに表示する
End Sub

※「オブジェクト」とは、操作を指示する際に、操作の対象となる「物」のことをいいます。このケースでは、オブジェクトは「ファイル(Book)」を指しています。

0
0
0

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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?