Excel 2016 Open another workbook and make Active

berty2000

Board Regular
Joined
Mar 29, 2011
Messages
71
Hi

I have just upgraded to excel 2016 and Im having problems opening another workbook from a userform and making it the active one.
It opens it ok, but you cant type anything unless you change to another sheet first then back again, it seems to still be active on the original workbook.

Code works fine on Excel 2010

This is what I have been using.

Code:
Private Sub CommandButton2_Click()
'Sickness Back To Work Interview


'unload form and remove shape
    Unload Me
        ActiveSheet.Shapes("Rectangle 3").Visible = False
            Range("AC3").Select


'File Location
        fname = "Back to work interview.xlsm"
        fpath = "U:\Team Leader Dashboard\Miscellaneous\" & fname




    On Error Resume Next      ' drive or file may not be available.  If so error msg
          Set wb = Workbooks.Open(fpath)
          If wb Is Nothing Then
            MsgBox "File is Not Accessible"
            GoTo handle


          wb.Activate


        End
    End If
handle:
End Sub
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Seems to be not working only if i try to open a workbook from a userform if that makes any difference?
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

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