While Vlookup in macro excel asking password

gssachin

Board Regular
Joined
Nov 14, 2013
Messages
155
Hi,

I put following code in my workbook macro

.Formula = ("=VLOOKUP("a",'C:\Misc\TestDir\[2016_TestWB.xls]Data'!$B$2:$E$4,3,0)")

My
C:\Misc\TestDir\2016_TestWB.xls is password protected (Password is "Abc123")

If my above file open and I run the Macro then its working fine (Not getting popup for "Password")
But when the said workbook is close then Excel asking password and then running the code.

So where I can declare the password of workbook so excel will not open the file but also not give popup to enter password also.
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
couple of options to try / consider

- check if the file is closed, if so open it, write formulas then close it again without saving changes
- add application.displayalerts = false before you write formula. (Remember to switch back to true afterwards)
 
Upvote 0

Forum statistics

Threads
1,203,171
Messages
6,053,878
Members
444,692
Latest member
Queendom

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