I was put in charge of developing a new inspection report at my work and as of a few days ago never even knew about macros or anything like that. Through researching online I was finally able to develop 2 macros for hiding/unhiding sensitive information that we do not want the customer to know (ie specific part dimensions). I then assigned those macros to a command toggle button (togglebutton1) so that when pressed in, the text read "customer copy" and certain rows in each sheet were hiddend, and when not pressed in, it read "internal copy" and the rows were visable.
Right now my issue is that if we were to send the customer the report, there is nothing keeping them from being able to press the button I made up... even with the sheet protected, workbook protected, and even if the workbook is saved as a "read-only" document.
So I need a way to either password protect the button, hide the button when the sheet/workbook is protected, or simply disable the button when the sheet/workbook is protected.
Here is the code for the toggle button ("Hide" and "Unhide" are the specific macros for hiding/unhiding the specific rows in each sheet):
Private Sub ToggleButton1_Click()
If ToggleButton1.Caption <> "Customer Copy" Then
ToggleButton1.Caption = "Customer Copy"
CallPressState
Else
ToggleButton1.Caption = "Inernal Copy"
CallPressState
End If
End Sub
Sub CallPressState()
If ToggleButton1.Caption = "Customer Copy" Then
Application.Run "Hide"
Else
Application.Run "Unhide"
End If
End Sub
Any help is greatly appreciated!
Right now my issue is that if we were to send the customer the report, there is nothing keeping them from being able to press the button I made up... even with the sheet protected, workbook protected, and even if the workbook is saved as a "read-only" document.
So I need a way to either password protect the button, hide the button when the sheet/workbook is protected, or simply disable the button when the sheet/workbook is protected.
Here is the code for the toggle button ("Hide" and "Unhide" are the specific macros for hiding/unhiding the specific rows in each sheet):
Private Sub ToggleButton1_Click()
If ToggleButton1.Caption <> "Customer Copy" Then
ToggleButton1.Caption = "Customer Copy"
CallPressState
Else
ToggleButton1.Caption = "Inernal Copy"
CallPressState
End If
End Sub
Sub CallPressState()
If ToggleButton1.Caption = "Customer Copy" Then
Application.Run "Hide"
Else
Application.Run "Unhide"
End If
End Sub
Any help is greatly appreciated!