Vba experts: Saving as current worksheet not workbook

bamaisgreat

Well-known Member
Joined
Jan 23, 2012
Messages
831
Office Version
  1. 365
Platform
  1. Windows
The code below is what I am currently using. Looking through the code you will see that I save the workbook as the current date and time. The problem Im having is that I would like sheet1 to be the only one to save. I have several more sheets in this workbook that I dont want in the save as date and time.

Code:
 ActiveWorkbook.SaveAs Filename:="H:\Burney Table\CUTTING FORMS (Protected by QC)\" & _
    Format(Now(), "mm-dd-yyyy hh-mm-ss") & "   56 Mach STOCK FORM", FileFormat:=xlNormal _
    , Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
    CreateBackup:=False
    Range("I4").Select
    
    ButtonNames = Array("Button 4")
    
    For Each ButtonName In ButtonNames
    ActiveSheet.Buttons(ButtonName).Visible = False
    Next ButtonName
  
 ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    "H:\Burney Table\Cutting Forms PDF\" & Format(Now(), "mm-dd-yyyy hh-mm-ss") & "   56 MACH       STOCK.pdf", Quality:= _
    xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
    OpenAfterPublish:=True
    
    ActiveWorkbook.Save
    ActiveSheet.Unprotect
    
    With Range("$g$1:$j$1")
   .Locked = False
   .FormulaHidden = False
    End With
    
   
    ActiveSheet.Protect Password:="1288", DrawingObjects:=True, Contents:=True, Scenarios:=True
    
    ActiveWindow.Zoom = 147
    ActiveWorkbook.Save
    
    
    Workbooks.Open ("H:\Burney Table\56 MACHINE\operators form\56 MACHINE.xls")
    Windows("56 MACHINE.xls").Activate
    
    
    ThisWorkbook.Close SaveChanges = True
    
    Application.Quit 
    End Sub
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Copy the sheet of interest, which then becomes the activeworkbook. Then save.
 
Upvote 0
ok, Ive tried coping the sheet in a macro but its not very clear of what Im needing. Could you possibly help me with a little code to get me started
 
Upvote 0
Code:
    Const sPath     As String = "H:\Burney Table\CUTTING FORMS (Protected by QC)\"
    Const sFile     As String = "56 Mach STOCK FORM"

    ActiveSheet.Copy
    ActiveWorkbook.SaveAs _
            Filename:=sPath & Format(Now(), "yyyy-mm-dd hhmmss ") & sFile, _
            FileFormat:=xlNormal
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top