MrExcel Publishing
Your One Stop for Excel Tips & Solutions

VB for selected document


Posted by Casey on January 18, 2002 8:38 AM

How do I set the name of the active document equal to a variable? I have a macro that needs this function to work. Please let me know if you have any suggestions
thanks
Casey


Posted by Russell Hauf on January 18, 2002 11:32 AM

Sub GetDocName()
Dim strName As String

' Workbook name
strName = ActiveWorkbook.Name
' Sheet name
strName = ActiveSheet.Name

End Sub

Is this what you're looking for?

-Russell


End Sub