471,893 Members | 1,589 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,893 software developers and data experts.

Excel VBA passing over "ObjAccess.DoCmd.RunMacro"

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
Aug 7 '19 #1

✓ answered by Rabbit

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 1641
Rabbit
12,516 Expert Mod 8TB
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.
Aug 7 '19 #2
NeoPa
32,470 Expert Mod 16PB
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.
Aug 20 '19 #3

Post your reply

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

Similar topics

3 posts views Thread by user_5701 | last post: by
2 posts views Thread by madeleine | last post: by
3 posts views Thread by JohnM | last post: by
1 post views Thread by stephendeloach via AccessMonster.com | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.