0

Hoping you might be able to help me with this question or to point me in the right direction. I am trying to use a Macro so that when I click on a button and sheet 1, it will look for an embedded object in sheet 2 and open it.

I have three buttons: Strategy 1 Stratgey 2 Strategy 3

Each of them open seperate workbooks e.g. Strategy 1 will open Test Plan 1, Strategy 2 will open Test Plan 2, etc.

Below is the code that I have for Strategy One. This is repeated for Strategy 2 and 3 by just replacing the sub name with two and three with the same for OLEObjects being changed to TestTwo/TestThree/etc.:

Sub StrategyOneTesting()
    Dim oEmbFile As Object
    Application.DisplayAlerts = False
    Set oEmbFile = ThisWorkbook.Sheets("TestPlans").OLEObjects("TestOne")
    oEmbFile.Verb Verb:=xlPrimary
    Set oEmbFile = Nothing
    Application.DisplayAlerts = True
End Sub

The problem I am having is that it will work for my laptop (working on Windows 10 Excel 2016), however it won't work on my other laptop working off Windows 10 Excel 2013. The error below always appears:

Run-Time Error '1004'. Unable to get the OLEObjects property of the Worksheet Class

Thanks

4

0 回答 0