Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Look at the SaveCopyAs method.
-- Vasant "norika" wrote in message ... Hi all experts, I am new to excel VBA, and need some help in this topic. I got a excel data file , and its data would be changed day by day. In order to trace mistakes and backup reason, I'm going to create some vba coding to make a backup file in the same directory if I pressed a custom button in my tool bar. I create a stupid macro to save the active orginial file to another file name, but after the code finish running, the existing file already replaced by new file, because I used "SAVE AS" function in my coding. What should I do if I just want an to copy my existing file to the same directory? Is it possible to run a dos command like " copy xxx.xls yyy.xls" in VBA? Best Regards, Newbie. **************** Sub Macro1() ' ' marco save file ' Dim wks As Worksheet Dim spath As String Dim sfilename As String Dim sfilename1 As String Dim sfilename2 As String Dim fullname As String Dim dayname As String Dim monthname As String Application.ScreenUpdating = False Application.DisplayAlerts = False spath = "c:\documents and settings\kay\my documents\logistics\semiwell\" dayname = CStr(Day(Now())) monthname = getmonth(Month(Now())) sfilename1 = "Semi_Bup_" & dayname & monthname sfilename2 = ".xls" fullname = sfilename1 & sfilename2 ActiveWorkbook.SaveAs Filename:=(spath & fullname), _ FileFormat:=xlNormal, Password:="", _ writerespassword:="", _ ReadOnlyRecommended:=False, _ CreateBackup:=False addtomru = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
command code ( GOTO command) in formula | New Users to Excel | |||
Pivot Table Error Message - "Command Text not set for command obje | Excel Discussion (Misc queries) | |||
Creating a Command Button on a worksheet | Excel Discussion (Misc queries) | |||
Creating Command button Conditionally | Excel Programming | |||
Exel2000 VBA - Creating a Command Bar - Error: "Object Variable or With not Set" | Excel Programming |