Workbook opening and vba code remains in foreground

David Miles

New Member
Joined
Aug 19, 2016
Messages
1
Hi Guys,

Can you help with the following code. Whenever it opens the workbook opens and is then hidden behind the original userform coding page instead of in the foreground

Rich (BB code):
Rich (BB code):
Unload UserForm1


Dim WbookCheck As Workbook
     
    On Error Resume Next
    Set WbookCheck = Workbooks("C:\Users\gps943205\Desktop\OCVNM\DOSSIER FOLDERS\OCVNM-DC DOCUMENT CONTROL\OCVNM-DC 18 HEALTH\OCVNM-DC 18 C - MATERIAL SAFETY DATA SHEET\OCVNM CHEMICALS - MSDS.xls")
    On Error GoTo 0
     
    If WbookCheck Is Nothing Then 'Closed
        Workbooks.Open "C:\Users\gps943205\Desktop\OCVNM\DOSSIER FOLDERS\OCVNM-DC DOCUMENT CONTROL\OCVNM-DC 18 HEALTH\OCVNM-DC 18 C - MATERIAL SAFETY DATA SHEET\OCVNM CHEMICALS - MSDS.xls"
    ElseIf Application.ActiveWorkbook.Name = WbookCheck.Name Then
        WbookCheck.Close SaveChanges:=True
    Else
        WbookCheck.Activate
        WbookCheck.Visible = True
    End If
ActiveWindow.WindowState = xlMaximized
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Maybe try adding

Code:
Workbooks("C:\Users\gps943205\Desktop\OCVNM\DOSSIER FOLDERS\OCVNM-DC DOCUMENT CONTROL\OCVNM-DC 18 HEALTH\OCVNM-DC 18 C - MATERIAL SAFETY DATA SHEET\OCVNM CHEMICALS - MSDS.xls").Activate
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,123
Members
452,381
Latest member
Nova88

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