From: LRay67 on 2 Mar 2010 16:41 Ron your code works great. Is there a way to incorporate into the code that allows me to pick up a textbox with the data entered in there to be part of the file name upon saving the workbook? "Ron de Bruin" wrote: > You can use GetSaveAsFilename > > Sub Test() > Dim fname As Variant > Dim Wb As Workbook > Set Wb = ActiveWorkbook > > fname = Application.GetSaveAsFilename("", _ > fileFilter:="Excel Files (*.xls), *.xls") > If fname <> False Then > Wb.SaveAs fname > 'Wb.Close False > Set Wb = Nothing > Else > Set Wb = Nothing > End If > End Sub > > > -- > Regards Ron de Bruin > http://www.rondebruin.nl > > > "khlaudhya" <khlaudhya(a)discussions.microsoft.com> wrote in message news:598B4C24-36D1-477C-8405-CB8DBD8D3512(a)microsoft.com... > > Hi, > > > > I'm building a code where at some point I need to save the file to a new location with a specific file name, which is also > specified by the code. I would like to be prompted for this but it only saves if I specify the path. > > > > This is the bit I have already written and can't go further: > > > > Dim NewName As String > > > > NewName = mRateName & " " & Validade & ".xls" > > > > If MsgBox("Save file as " & NewName & "?", vbYesNo, Save) = vbNo Then > > > > Exit Sub > > > > ActiveWorkbook.SaveAs FileName:=NewName > > > > Can anyone help me? > > > > Thanks > > >
|
Pages: 1 Prev: To use parameter with like. Next: SQL query in excel (VB) using multiple parameters |