error trap and exit procedure when MS Project app does not exist

Ken Cowen

Board Regular
Joined
Jan 18, 2015
Messages
217
I have some code that exports Excel info to MS Project, if MS Project is open. If MS Project does not exist on the computer this code generates an error in the Set projApp line. Why does it ignore the On Error Resume Next line? This is part of a significant application that needs to work on computers with and without Project. This particular function needs to run only if MS Project exists and is open.

Excel Formula:
Dim projApp As MSProject.Application
On Error Resume Next
Set projApp = GetObject(, "MSProject.Application")
On Error GoTo 0

If projApp Is Nothing Then
     Exit Sub
Else

Thanks

Ken
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
No issue on my side :​
VBA Code:
    Dim oMSP As Object
    On Error Resume Next
    Set oMSP = GetObject(, "MSProject.Application"):  If Err.Number Then Exit Sub
    On Error GoTo 0
 
Upvote 0
Solution

Forum statistics

Threads
1,215,616
Messages
6,125,865
Members
449,266
Latest member
davinroach

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