Hiding the Workbook Password Input Box VBA - Excel 2010

IAIPICI

New Member
Joined
Nov 16, 2010
Messages
25
Hello,

I've been working on 2 workbooks, one "Master.xlsm" is for inputting of information (Workbook Protected) the other "Viewer.xlsm" is for displaying it in a similar to read-only format (Sheet Protected Only). The main information which is shared between the two is the background color of the cells in the Master Workbook.

After doing some research from different forums I have mixed together this below code which works a charm. The only Problem I have at the moment is when the "Viewer" workbook requests the information it obviously needs to un-protect the "Master" workbook, I have added to the code to do this, however I am still receiving the Input Password Box. It doesn't matter if I leave it blank press ok, or cancel, it will still run the code which is great! But I really don't want that box to come up at all requesting a password as it is unnecessary & will confuse the users.

Code:
Sub GrabColors()
Dim OMaster As Workbook
Dim Viewer As Workbook
Dim Master As Workbook


Set OMaster = Workbooks.Open("D:\\Master.xlsm", Password:="pass")
Set Viewer = Workbooks("Viewer.xlsm")
Set Master = Workbooks("Master.xlsm")


Application.CutCopyMode = True




  OMaster.Activate


    Range("B4:NA9").Select
        Selection.Copy
  Viewer.Activate
    Range("B4:NA9").Select
        Selection.PasteSpecial Paste:=xlPasteFormats, _
            Operation:=xlNone, SkipBlanks:=False, _
            Transpose:=False


 Master.Activate
    Range("B11:NA34").Select
        Selection.Copy
                
  Viewer.Activate
    Range("B11:NA34").Select
        Selection.PasteSpecial Paste:=xlPasteFormats, _
            Operation:=xlNone, SkipBlanks:=False, _
            Transpose:=False
                Range("B4").Select
  Master.Activate
    Me.Saved = True
Application.CutCopyMode = False
  Master.Close
End Sub

Is there a way I can at least hide that password box? Help would be greatly appreciated! :biggrin:
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,216,096
Messages
6,128,809
Members
449,468
Latest member
AGreen17

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