Workbook_Open Event

sspatriots

Well-known Member
Joined
Nov 22, 2011
Messages
585
Office Version
  1. 365
Platform
  1. Windows
Hi,

This is similar to a previous post, except it is a question on opening several files as ReadOnly when I open the workbook. I open all four of the files below when I launch this one workbook using the "Workbook_Open" event. The problem is one of these files stops the code with a message that says:

'The author would like you to open 'Production Schedule.xlsm' as read-only unless you need to make changes. Open as read-only?

I realize this is a setting on that file, but if my code below is telling it to open as "ReadOnly" why would it ask me that question anyway. I'd like to prevent that from popping up as I'm opening this file. I tried turning off ".Displayalerts" before this line in the code, but the message still pops up. Any thoughts on how to prevent this without telling the owner of the other file to turn that recommendation off would be greatly appreciated.


Thanks, SS

VBA Code:
    file_path1 = "H:\Jobs\PO Block History.xlsm"
    file_path2 = "G:\Manufacturing\Manufacturing Detail Schedule1.xlsx"
    file_path3 = "H:\Shop Files\MRL Production Schedule\Production Schedule.xlsm"
    file_path4 = "H:\Jobs\00 ENGINEERING DATA\Job List.xlsm"

    Set my_wb1 = Workbooks.Open(Filename:=file_path1, ReadOnly:=True)
    Set my_wb2 = Workbooks.Open(Filename:=file_path2, ReadOnly:=True)
    Set my_wb3 = Workbooks.Open(Filename:=file_path3, ReadOnly:=True)
    Set my_wb4 = Workbooks.Open(Filename:=file_path4, ReadOnly:=True)
 
Maybe you could hide the other 3 supporting workbooks (View|Hide) and save them. Then when they load, you won't see them flash
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Visible = False will actually hide the workbook (in the same way that a personal macro workbook is hidden). Activewindow.windowstate = xlminimized would minimise the window.
 
Upvote 0
Nevermind, just stumbled across it.

I substituted the ActiveWindow.Visible False statements with the following and it worked:

VBA Code:
ActiveWindow.WindowState = xlMinimized


I think I'm good on this one for now. Thanks everyone for the help. Onto cleaning up my workbook close event...
 
Upvote 0
Visible = False will actually hide the workbook (in the same way that a personal macro workbook is hidden). Activewindow.windowstate = xlminimized would minimise the window.
I saw your response right after I put that line of code in there. Thanks for the explanation.
 
Upvote 0

Forum statistics

Threads
1,223,950
Messages
6,175,582
Members
452,653
Latest member
craigje92

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