ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date Filename Save as Dialog Macro Thingy!!!!!! (https://www.excelbanter.com/excel-programming/357606-date-filename-save-dialog-macro-thingy.html)

Cobbcouk[_2_]

Date Filename Save as Dialog Macro Thingy!!!!!!
 

Hi there excel peeps, Hope you all are well.

I've got a bit of a problem, no one I know can help, and I can't find
the A team!!!!

PLEASE.

Can anyone give me the Visual Basic Code to open up a 'save as' dialog
box, with the filename as 'dd/mm/yy_sportsreturn', (dd/mm/yy being the
save date or a cell reference to a date), but give the user the ability
to save the file where they want to?

I've had a few goes, but i'm new to VBA and I can get the file to save
as a date formatted filename but I can't just get the box to open with
the correct filename, filetype(excel), and let the user put it where he
wants. It's getting a bit frustrating.

If i'm asking too much from excel/VBA can someone just give me a nudge,
i'll shut up and go do an ECDL course or something :)

Many Thanks in advance

Gaz


--
Cobbcouk
------------------------------------------------------------------------
Cobbcouk's Profile: http://www.excelforum.com/member.php...o&userid=32143
View this thread: http://www.excelforum.com/showthread...hreadid=528247


Cobbcouk[_3_]

Date Filename Save as Dialog Macro Thingy!!!!!!
 

PS

ive had a look round the forums and can't find an answer!!!!!

:

--
Cobbcou
-----------------------------------------------------------------------
Cobbcouk's Profile: http://www.excelforum.com/member.php...fo&userid=3214
View this thread: http://www.excelforum.com/showthread.php?threadid=52824


NickHK

Date Filename Save as Dialog Macro Thingy!!!!!!
 
Cobbcouk,
You need to look at "GetSaveAsFilename".

Dim FileName as string
Dim RetVal As Variant

FileName=Format(Now(), "dd/mm/yy") & "_sportsreturn.xls"
str = Application.GetSaveAsFilename(FileName)
'make sure the user did not change the filename
If str<FileName Then
Msgbox "No, file must be called " & FileName
Exit sub
Else
'OK to save
Thisworkbook.SaveAs FileName
End If

You need to handle the case when the clicks also. Hint: RetVal=False

NickHK

"Cobbcouk" wrote in
message ...

Hi there excel peeps, Hope you all are well.

I've got a bit of a problem, no one I know can help, and I can't find
the A team!!!!

PLEASE.

Can anyone give me the Visual Basic Code to open up a 'save as' dialog
box, with the filename as 'dd/mm/yy_sportsreturn', (dd/mm/yy being the
save date or a cell reference to a date), but give the user the ability
to save the file where they want to?

I've had a few goes, but i'm new to VBA and I can get the file to save
as a date formatted filename but I can't just get the box to open with
the correct filename, filetype(excel), and let the user put it where he
wants. It's getting a bit frustrating.

If i'm asking too much from excel/VBA can someone just give me a nudge,
i'll shut up and go do an ECDL course or something :)

Many Thanks in advance

Gaz


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

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





All times are GMT +1. The time now is 01:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com