Consulting

Results 1 to 12 of 12

Thread: Create a Hardcoded Workbook Copy

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Mentor
    Joined
    Nov 2020
    Location
    Cochin, Kerala
    Posts
    314
    Location

    Create a Hardcoded Workbook Copy

    Hi

    I' getting the following error while running the trailing code. Could somebody please help me to correct the codes?

    Thanks in advance

    error.jpg

    Sub Hardcoded_Workbook_Copy()
    
        Dim FilePath As String
        Dim HCName As String
            
        FilePath = ActiveWorkbook.Path & "\"
        HCName = "HC_" & VBA.Format(Date, "ddmmyy") & "_" & ActiveWorkbook.Name
        ActiveWorkbook.Save
        Sheets.Select
        Cells.Copy
        Cells.PasteSpecial xlPasteValues
        Range("A1").Select
        Sheets(1).Select
        ActiveWorkbook.SaveAs Filename:=FilePath & HCName
        
    End Sub
    Attached Files Attached Files

Posting Permissions

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