file.open with password when file is open elsewhere

DiegoTurpentine

New Member
Joined
Nov 22, 2019
Messages
1
Hi,

This is driving me mad. Have written some VBA code to open a specific file and do some things. If it opens in read only mode, then it closes the file, waits 5 seconds and reopens on a loop until it gets in with write access. Which is fine, the file is only accessed very briefly to populate with production data, but multiple times a day from multiple production files.

However, we now have a password on the file, which I've added to the code and it works fine, except when another person is already in the file. Then it asks the user for the password which I can't have. I'm sort of sure it's related to the additional 'file in use' box which would appear if you tried to open a password protected file and somebody else was in it. I can't get around it though.

Any ideas?

Cheers
 

Attachments

  • 1574439623649.png
    1574439623649.png
    52.6 KB · Views: 14

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Have you tried putting Application.DisplayAlerts = False before the code to open the workbook, and Application.DisplayAlerts = True once it has successfully opened? This should prevent the warning message being displayed, and just select the default option - which is to open as read-only.
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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