By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,251 Members | 2,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,251 IT Pros & Developers. It's quick & easy.

Excel VBA passing over "ObjAccess.DoCmd.RunMacro"

P: 1
I have an excel report where I created a VBA component that is supposed to open an Access (Office 365) database and run a macro in that database. On my computer and another colleague's it works perfectly. On two other people's computers, everything works except that their machines will open the database, but it won't run the macro. We have verified that they have enabled macros so that's not the reason. I have no idea why it won't run the macros. When we do it manually it works as well. I'm stuck here!! The VBA code in question is below. Thanks for any help!

Expand|Select|Wrap|Line Numbers
  1. Dim FSO
  2. Set objFSO = CreateObject("Scripting.FileSystemObject")
  3. On Error Resume Next
  4.  
  5. Set ObjAccess = CreateObject("Access.Application")
  6.  
  7. ObjAccess.OpenCurrentDatabase "MYDATABSE.accdb"
  8. ObjAccess.DoCmd.RunMacro "05 - Import New Additions and Add to Master Data"
  9. Set ObjAccess = Nothing
2 Weeks Ago #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,359
There's probably an error being thrown. But you wouldn't see the error because you've turned off error messages. Turn it back on so you can see what the error is.
2 Weeks Ago #2

NeoPa
Expert Mod 15k+
P: 31,433
It's hard to say as you're not explaining things accurately.

Macros don't simply get enabled. There are various settings that control whether or not they run under which circumstances. This includes, but is certainly not limited to, folders that are designated as trusted.

We'll need the full and correct story before we can be of any real help I suspect.
2 Days Ago #3

Post your reply

Sign in to post your reply or Sign up for a free account.