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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -