Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving workbook with data from input box

Status
Not open for further replies.

pnb627

Technical User
Mar 11, 2003
2
US
I have a workbook that starts with the user having to click on a button and enter data into an input box. Once they have entered the data and click Ok, a new workbook is created and saved to a network folder and the template is closed.

I want the new workbook to save with the information that was entered in the input box as part of the file name when it is created.

Does this make sense and is it doable?

Thanks.
 

Of course it is doable! You can change the path for where it should go on the network.

Sub SaveNewWorkbook()
Dim wb As Workbook
Dim x As String
x = InputBox("Enter name to go in middle of file name")
Set wb = Workbooks.Add
'put what you want in the new workbook
wb.SaveAs ("C:\Startoffileneme" & x & "endoffilename")
ThisWorkbook.Close False
End Sub


Or is you want to save the template itself as a new workbook then use

Thisworkbook.SaveAs ("C:\Startoffileneme" & x _ & "endoffilename")



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top