473,837 Members | 1,553 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Excel VBA passing over "ObjAccess.DoCm d.RunMacro"

5 New Member
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
2 1743
Rabbit
12,516 Recognized Expert Moderator MVP
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,584 Recognized Expert Moderator MVP
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

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

Similar topics

11
4063
by: Mr. Smith | last post by:
Hello all, My code can successfully open, write to, format and save several worksheets in a workbook then save it by a given name, close and quit excel. My problem is that if I try and do it again, Excel hangs. OR if I open Excel again (say from a desktop icon) before I close Access, Excel hangs. (this has happened for both 97 & 2000 for me) I of course thought that I mustn't be unloading a variable properly.
3
3006
by: user_5701 | last post by:
Hello, I have an Access 2000 database that I need to export certain queries to Excel 2000. The problem is that I have to take the toolbars away from the users for security purposes, but still let the users have the ability to export to Excel using forms and buttons, using vba code I write. I have attempted using the DoCmd.TransferSpreadsheet option, but it does not look formatted the way the "Analyze It with MS Excel" button does. To...
2
3508
by: madeleine | last post by:
I'm hoping the answer to this is that I'm just doing something silly, but I'm really scratching my head over this one. I'm importing data from multiple workbooks, each workbook has a sheet called SubSAT and I need to get specific data from that into the database. I'm finding that if I have the workbook open on my desktop then the SubSAT % complete and the High level plan % come in fine, but as soon as the workbook is closed they come...
3
1666
by: JohnM | last post by:
I can transfer my data from a table into an Excel Spreaadsheet with DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "Whatever", "Whatever" This saves the spreadsheet and the user has to open it. I would prefer the user to have Excel to open automatically with the data in it, then save it if they want to. I feel it ought to be easy but I may be looking in the wrong place.
3
1276
by: kaykae | last post by:
Hi all, This is an example of how my table look like A B C D E <<column headers 1 * * * * 2 * * * * 3 * * * * 4 * * * *
1
1273
by: stephendeloach via AccessMonster.com | last post by:
What I am trying to do is create a Form in Access, when the information is entered in the form it is sent to an Excel spreadsheet where it can be saved as a different file name and printed. Thanks. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/databases-ms-access/200705/1
1
2750
by: chuch0117291 | last post by:
Hi, i have a form with the main details of a vendor and and contract description and a budget reference(PK). Within this form, i have a sub form which includes cost details for that specific vendor but also has the same budget reference hence the link. I would like to create a command button to be able to export the data from the main form to an excel spreadsheet and the data from the sub form to excel spreadsheet tab2 from the click of a...
10
9319
by: Darkside12 | last post by:
Hi, A simple question but, is it possible to export a stored Procedure to excel using the docmd.TransferSpreadsheet function? If not, what is the easiest way to accomplish this?
0
1347
by: CD Tom | last post by:
I've build a query that I then transfer to Excel using the docmd.TransferSpreadsheet the transfer works just fine, but when I open the file in Excel (2007) I get a error saying the file is in a different format than specified by the extension .xls I have an option to open the file anyway and it comes up just fine. My problem is the person who will be using the program has excel 2003 and when I try and open the file all I get is garbage. ...
7
4812
by: hvsummer | last post by:
After long time testing in my database, upgraded a lot of part from first code, I'm very happy to show everyone my Import/Link Excel vba code that can be very usefull and stable. Function (not sub as I prefer call function in another function) ImportMultiData() Can import/Link excel table with additional option: Option - Link - True = Link table, False = Import Table, default = False And after 3 times trying to import/Link, Function...
0
9678
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10560
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7798
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6987
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5838
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4468
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4034
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3120
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.