JL Thalacker
JL Thalacker

Reputation: 45

How to write workbook name in cell using excel macro

I would like to write an excel workbook name (the current one) in a cell using an excel macro.

I've tried to use

"=RIGHT(CELL(""filename"",R[-9]C[1]),LEN(CELL(""filename"",R[-9]C[1]))-SEARCH(""]"",CELL(""filename"",R[-9]C[1])))"

and it seems to be buggy, I would like to use the

ActiveWorkbook method.

Upvotes: 1

Views: 908

Answers (1)

BigBen
BigBen

Reputation: 49998

Simply write the ActiveWorbook.Name to the cell, e.g.:

ActiveCell.Value = ActiveWorkbook.Name

Upvotes: 2

Related Questions