-1

As the title says, I want to get the name of the file saved as a string. I have

wstitle = Application.Caller.Worksheet.name

and it forces the n to lower case and doesn't work.

Tim Vowden
  • 13
  • 4
  • possible duplicate of [How to get the path of current worksheet in VBA?](http://stackoverflow.com/questions/2813925/how-to-get-the-path-of-current-worksheet-in-vba) – Alex K. Oct 09 '14 at 16:23
  • It would seem that the application call is referencing a different form of `.Name` than one of these standard calls. `wstitle = ThisWorkbook.Name` or `wstitle = ActiveWorkbook.Name`. –  Oct 09 '14 at 16:34

1 Answers1

0

This:

Sub luxation()
    Dim s As String
    s = ThisWorkbook.Name
    MsgBox s
End Sub

will display something like:

Book1.xlsm

NOTE:

The Path is omitted, but the extension is included.
ThisWorkbook is the workbook containing the code.

Gary's Student
  • 94,018
  • 8
  • 54
  • 89