Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Greetings,
I would like to place a command button on a worksheet that does the following: Save the file to the DESKTOP and at the same time append (the then current) TODAYS DATE to the filename. I suspect this is fairly straightforward, but I am new to this, and would appreciate any guidance. Regards, Todd D. Levy |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Todd
this code should give you what you need ********* Sub savetodesktop() Dim pname As String Dim fname As String pname = "C:\Windows\Desktop\" fname = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4) fname = fname & Format(Now, "ddmmyyyy") & ".xls" ActiveWorkbook.SaveAs Filename:="" & pname & fname & "" End Sub ********* however, depending on what version of windows you're running & how its all setup this "desktop" might not be the desktop you're seeing as your desktop so you might need to change the path to something like "C:\Documents and Settings\All Users\Desktop\" or instead of All Users your login name - to get the button you can use either the command button off the control toolbar or one of the drawing objects (under autoshapes on the drawing toolbar) .. either way, copy & paste the above code into a module in your workbook, create the drawing object on the sheet, right mouse click on it and choose assign macro and choose the savetodesktop macro. let us know how you go Cheers JulieD "Todd D. Levy" wrote in message .net... Greetings, I would like to place a command button on a worksheet that does the following: Save the file to the DESKTOP and at the same time append (the then current) TODAYS DATE to the filename. I suspect this is fairly straightforward, but I am new to this, and would appreciate any guidance. Regards, Todd D. Levy |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
command button add another command | Excel Discussion (Misc queries) | |||
2 part question - macro / command button | Excel Discussion (Misc queries) | |||
Command Button | Excel Programming | |||
Command Button vs Control Button | Excel Programming | |||
Command Button vs Form Button | Excel Programming |