Thread: Quick fix
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ardus Petus Ardus Petus is offline
external usenet poster
 
Posts: 718
Default Quick fix

To combine Nick's remarks with my solution, here is some code:

HTH
--
AP

'-------------
Sub test()
Dim fileName As String
ActiveSheet.Protect "sports"
fileName = Application.GetSaveAsFilename( _
InitialFileName:="U:\" & Format(Date, "dd_mm_yy") & "_sportsreturn", _
FileFilter:="Microsoft Excel Workbook (*.xls), *.xls" _
)
If fileName < False Then
ActiveWorkbook.SaveAs fileName:=fileName
End If
End Sub
'--------------

"NickHK" a écrit dans le message de
...
Cobbcouk,
With my code FileName will be filled with the text enter in the

appropriate
place on the dialog, assuming the user clicked OK instead of Cancel.
You then have do something with FileName, like .Save the file, as VBA does
not do this for you; it only provides an intuitive interface to get the
name/path.
So you still need:
ThisWorkbook.SaveAs FileName

Nick

"Cobbcouk" wrote in
message ...

Thanks for the quick response but im learning as i go with VBA. What do
you mean? And where should I write the filename? I kind of understand
the App.Get save as format but like I say, Im learning


--
Cobbcouk
------------------------------------------------------------------------
Cobbcouk's Profile:

http://www.excelforum.com/member.php...o&userid=32143
View this thread:

http://www.excelforum.com/showthread...hreadid=531827