vba - How to change the name of the document in Excel? -
i have macro enabled template called tip-pbi.xltm. when create document based on template, excel automatically names tip-pbi1. however, want give custom name.
i figured modifying .title property of workbook. end, on startup workbook_open event kicks off, , following executed:
private sub workbook_open() dim strpbi string strpbi = inputbox$("enter pbi", "enter pbi") thisworkbook.title = "tip-pbi-" & strpbi end sub
however, nothing.
how can change title of document on startup?
the way change workbook name save (ref)
thisworkbook.saveas thisworkbook.path & "" & filename & ".xls"
if want suggest name use getsaveasfilename or
application.filedialog(msofiledialogsaveas).initialfilename = thisworkbook.path & "" & filename & ".xls"
Comments
Post a Comment