I have the following macro for which I am getting two different problems.
The first problem is "Run-time error 1004: Unable to set the Hidden Property of the Range class". Here is my code. My workbook is shared and protected:
Private Sub CommandButton1_Click()
[A1].Activate
Call UnprotectSharing
Call PrintWorksheet
Call ProtectSharing
End Sub
Sub UnprotectSharing()
Dim Password As String
Password = "bp02acg"
ActiveWorkbook.UnprotectSharing Password
End Sub
Sub ProtectSharing()
Dim Password As String
Password = "bp02acg"
ActiveWorkbook.ProtectSharing Password
End Sub
Sub PrintWorksheet()
'
' PrintWorksheet Macro
' Macro recorded 2/18/2002 by Anita Grimes
'
'
[A3].Activate
Columns("A:B").Select
Selection.EntireColumn.Hidden = True
Columns("F:G").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.SmallScroll ToRight:=5
Columns("R:R").Select
Selection.EntireColumn.Hidden = True
Columns("U:U").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.SmallScroll ToRight:=6
ActiveWindow.ScrollColumn = 1
Range("C1:AB51").Select
ActiveSheet.PageSetup.PrintArea = "$C$1:$AB$51"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Cells.Select
Range("C1").Activate
Selection.EntireColumn.Hidden = False
ActiveWindow.SmallScroll ToRight:=10
Columns("V:V").Select
Selection.EntireColumn.Hidden = True
End Sub
My other problem is when the workbook goes through the "Protect Sharing" function it re-saves the workbook as "bp02acg.xls" as the filename instead of just saving over the existing file.
Please help, this is a verycritical piece of my project that is due at 5 pm today.
Thank you everyone!!!
Anita
The first problem is "Run-time error 1004: Unable to set the Hidden Property of the Range class". Here is my code. My workbook is shared and protected:
Private Sub CommandButton1_Click()
[A1].Activate
Call UnprotectSharing
Call PrintWorksheet
Call ProtectSharing
End Sub
Sub UnprotectSharing()
Dim Password As String
Password = "bp02acg"
ActiveWorkbook.UnprotectSharing Password
End Sub
Sub ProtectSharing()
Dim Password As String
Password = "bp02acg"
ActiveWorkbook.ProtectSharing Password
End Sub
Sub PrintWorksheet()
'
' PrintWorksheet Macro
' Macro recorded 2/18/2002 by Anita Grimes
'
'
[A3].Activate
Columns("A:B").Select
Selection.EntireColumn.Hidden = True
Columns("F:G").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.SmallScroll ToRight:=5
Columns("R:R").Select
Selection.EntireColumn.Hidden = True
Columns("U:U").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.SmallScroll ToRight:=6
ActiveWindow.ScrollColumn = 1
Range("C1:AB51").Select
ActiveSheet.PageSetup.PrintArea = "$C$1:$AB$51"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Cells.Select
Range("C1").Activate
Selection.EntireColumn.Hidden = False
ActiveWindow.SmallScroll ToRight:=10
Columns("V:V").Select
Selection.EntireColumn.Hidden = True
End Sub
My other problem is when the workbook goes through the "Protect Sharing" function it re-saves the workbook as "bp02acg.xls" as the filename instead of just saving over the existing file.
Please help, this is a verycritical piece of my project that is due at 5 pm today.
Thank you everyone!!!
Anita