Results 1 to 3 of 3

VBA command button for saving as date stamped copy in new location (and original)

Threaded View

Ogunhe VBA command button for saving... 01-07-2012, 09:47 PM
venkat1926 Re: VBA command button for... 01-08-2012, 03:32 AM
Ogunhe Re: VBA command button for... 01-08-2012, 10:31 AM
  1. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: VBA command button for saving as date stamped copy in new location (and original)

    first a folder must be opened in the main folder


    then create a command button in the sheet. and if it is not named as commandbutton1 name it like that

    now insert this event code there(right clilck the sheet tab and click view code)

    Private Sub CommandButton1_Click()
    Dim Filename As String, Filepath As String
    Filename = ThisWorkbook.Name
    Filepath = ThisWorkbook.Path & "\Log1\"
    
    '===================================================
    'NewFileName = Application.GetSaveAsFilename(InitialFileName:=Filepath & Filename & " " & Format(Now(), "mmddyy") & ".xls")
    'If NewFileName = "FALSE" Then Exit Sub
    '
    'ActiveWorkbook.SaveCopyAs Filename:=NewFileName
    '
    'On Error Resume Next
    '
    'ActiveWorkbook.SaveAs ThisWorkbook.FullName
    '==========================================================
    ThisWorkbook.SaveAs Filepath & Filename & " " & WorksheetFunction.Text(Date, "mmddyy") & ".xls"
    ThisWorkbook.Save
    End Sub
    Last edited by venkat1926; 01-08-2012 at 03:37 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1