Macro problem trying to open workbook

shrek

Board Regular
Joined
Dec 16, 2005
Messages
244
I have a macro that im trying to open a workbook with which is shown below.


Workbooks.Open Filename:="R:\c2c\SUMMARY.XLS", UpdateLinks:=3
Password = "trumpton"
End Sub

The trouble im having is that it keeps asking for the password BEFORE it open the workbook. Can anyone help?

Many Thanks
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

onlyadrafter

Well-known Member
Joined
Aug 19, 2003
Messages
5,703
Platform
  1. Windows
Hello,

Try something like this, on one line.

Code:
Workbooks.Open Filename:="R:\c2c\SUMMARY.XLS", UpdateLinks:=3, writerespassword:="trumpton"

nice password - always preferred Camberwick Green! :biggrin:
 

shrek

Board Regular
Joined
Dec 16, 2005
Messages
244
Tried that but didnt unfortunally work. I assume that I was correct in putting the macro in the workbook where I want to open it from? Unfortunally it still askes for password. Could it be that the workbook its opening is unprotected already? Im just trying to get it so it dont keep asking for the password before it opens it.
 

onlyadrafter

Well-known Member
Joined
Aug 19, 2003
Messages
5,703
Platform
  1. Windows
Hello,

What happens when you open the workbook manually? Does it ask for a password?

Which workbook is this code in? is it the SUMMARY.xls, or another one?
 

shrek

Board Regular
Joined
Dec 16, 2005
Messages
244

ADVERTISEMENT

When I open the workbook manually it asks me for the password and when I input it opens the summary workbook ok. The macro is in a workbook called "passacc" which it opens from using a macro button
 

onlyadrafter

Well-known Member
Joined
Aug 19, 2003
Messages
5,703
Platform
  1. Windows
Hello,

WHen you open the workbook, on the password entry, is it giving you the option to Read Only, If not try

Code:
Workbooks.Open Filename:="R:\c2c\SUMMARY.XLS", UpdateLinks:=3, password:="trumpton"
 

shrek

Board Regular
Joined
Dec 16, 2005
Messages
244
Many Thanks

I tried that but it didnt wanna have it unless I typed in something wrong.
 

Forum statistics

Threads
1,136,370
Messages
5,675,365
Members
419,565
Latest member
Phil57

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
Top