Password Supplied not correct - Error when opening workbook (on first try)

dreen

Board Regular
Joined
Nov 20, 2019
Messages
52
I have two workbooks, and in the workbook where the code is in (the codename of the sheet is "Sheet1") I run a code to transpose some values to another external workbook ( workbook "y" in this case with the "Changes" sheet).
Everytime I try to open up that second workbook "y" after I execute this module, it ALWAYS prompts me with the following message when I try to open it for the first time without typing or click anything (it lets me enter in a password when I close this message box and retry to open Workbook "y"):

"The password you supplied is not correct. Verify that the CAPS LOCK key is off and be sure to use the correct capitalization" (A Screenshot of the error msg box is below)

error message.JPG

This is the code I am running in the macro to execute the code:

VBA Code:
Sub SendChanges()

Application.ScreenUpdating = False

Set y = Workbooks.Open(Filename:="\FILEPATH\Database_IRR 200-2S New.xlsm", Password:="Swarf")
    
With y     
        .Sheets("Changes").Range("F2:CI2") = Application.Transpose(Sheet1.Range("K30:K111"))
        .Sheets("Changes").Range("CM2") = Application.Transpose(Sheet1.Range("K115"))

     y.Password = "Swarf”     
     y.Save
     y.Close False

 End With

Application.ScreenUpdating = True

End Sub

Please let me know if you have any questions or suggestions
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Cross posted Pasword Supplied not correct- VBA code error

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,215,694
Messages
6,126,253
Members
449,305
Latest member
Dalyb2

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