J Jess Jan 28, 2010 #1 How can I get in excel the file name and the full path to the file? Is there a VBA command that retrieves this info? Thanks
How can I get in excel the file name and the full path to the file? Is there a VBA command that retrieves this info? Thanks
M Mike H Jan 28, 2010 #2 Hi mypath = ThisWorkbook.FullName -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question.
Hi mypath = ThisWorkbook.FullName -- Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question.
J Jess Jan 28, 2010 #3 How can I also create a footer whose content is the full path followed by the file name? Thanks
D Dave Peterson Jan 28, 2010 #4 Dim wkbk as workbook set wkbk = activeworkbook 'thisworkbook or workbooks("book1.xls") msgbox wkbk.name msgbox wkbk.Fullname msgbox wkbk.Path If you're creating a new workbook in your code and you want to test to see if it's been saved: if wkbk.path = "" then 'not saved else 'saved end if
Dim wkbk as workbook set wkbk = activeworkbook 'thisworkbook or workbooks("book1.xls") msgbox wkbk.name msgbox wkbk.Fullname msgbox wkbk.Path If you're creating a new workbook in your code and you want to test to see if it's been saved: if wkbk.path = "" then 'not saved else 'saved end if
G Gord Dibben Jan 28, 2010 #5 Delete what you don't want. Sub PathInFooter() ActiveSheet.PageSetup.RightFooter = ActiveWorkbook.FullName & " " & _ ActiveSheet.Name & " " & Application.UserName & " " & Date End Sub Gord Dibben MS Excel MVP
Delete what you don't want. Sub PathInFooter() ActiveSheet.PageSetup.RightFooter = ActiveWorkbook.FullName & " " & _ ActiveSheet.Name & " " & Application.UserName & " " & Date End Sub Gord Dibben MS Excel MVP
R Ryan H Jan 28, 2010 #6 Choose Insert Footer and put this in the Left, Center, or Right Footer &[Path]&[File]&[File] Hope this helps! If so, let me know, click "YES" below.
Choose Insert Footer and put this in the Left, Center, or Right Footer &[Path]&[File]&[File] Hope this helps! If so, let me know, click "YES" below.