How to tell if your application is Project or Excel with VBA? -
i have created custom class adds references based on macros need run on particular project or excel file. class works both ms project , excel. problem having in code how can determine if application project or excel file? code works default assuming in excel file, if error occurs handle error switching code "activeworkbook" "activeproject". there way can avoid using error handling , run check see in. thanks!
@jeeped's comment points simple answer--test name property of application object. not in immediate window, of course, in if statement: if application.name = "microsoft excel" then...
.
Comments
Post a Comment