473,804 Members | 3,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Running Access Macro from Excel

2 New Member
I am trying to run an access macro from an excel application. i found the following code and tried to implement it but i keep getting a error 2046:

i go to references and set the references to :
Microsoft Access 12.0 Object Library

Expand|Select|Wrap|Line Numbers
  1. Dim strDB As String
  2.     Dim A As Object
  3.     Application.ScreenUpdating = False
  4.  
  5.     Set A = CreateObject("Access.Application")
  6.     strDB = "C:\od_track.mdb"
  7.  
  8.     A.OpenCurrentDataBase strDB
  9.     A.Visible = False
  10.     A.DoCmd.RunMacro "OD PROJECTIONS MACRO"
  11. 'Note: i even tried "[OD PROJECTIONS MACRO]"
  12.     A.Quit
  13.  
Any help would be greatly appreciated
Apr 1 '10 #1
1 1863
ADezii
8,834 Recognized Expert Expert
The code, in and of itself, is fully operational and produced no Error on my end. It was tested in Access 2002. The problem may lie with the Macro itself and what it is attempting to do. Create another, simple Macro, say just a Message Box, and see what happens when you try to execute it from Excel.
Apr 1 '10 #2

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

Similar topics

1
1771
by: Sylvia | last post by:
Dear All, Would appreciate if someone can help me out on this. I have an Excel Add-in which is only available on the web server. The Add-in allows user to retrieve data from a proprietary database. I have configured an Excel workbook to retrieve the data via the Add-in base on some inputs that the user enter in some cells (B7 and B8) in sheet1.
0
2089
by: Alex | last post by:
i have a module in Access which opens an existing Excel file and envokes a macro within the Excel file to draw graphs. now i am trying to convert the Excel macro to an Access one so that the converted Access macro can do the same thing as the Excel macro does when i open the Excel file. Can anybody give me a hint? Thanks in advance! Alex
2
7655
by: geronimo_me | last post by:
Hi, I have the following code in an access module: Sub Run_Excel_Macro() Dim xls, xlWB As Object Dim strFile, strMacro As String
6
9864
by: geronimo_me | last post by:
Hi, I am trying to run an Excel macro from an Access module, however when I run the code the macro runs but then I get an error in Access. The error is: Run-time error "440", Automation error. My code is: Sub Run_Excel_Macro() Dim xls, xlWB As Object
3
4565
by: etwebbox | last post by:
Hoping someone has some ideas on how to solve this issue: I have a macro in excel which runs a query against an Access DB (it actually calls a query inside of Access). The query is not bringing back all of the records even though I can run the query directly in Access or Microsoft Query and get all the records returned. For ease of troubleshooting the query can be a simple select * call from the macro to Access. Even with this basic call...
2
1969
by: michael | last post by:
Hi, folks - I am trying to build a macro that Outputs a query to Excel, then Auto Starts the Excel doc to show the query results. I'd like Excel to be the top window when this is done, but my macro always restores MS Access to the front when it finishes, hiding the new Excel doc. I've tried ending my macro with "MinimizeApp", but it simply minimizes Access... then immediately restores it again, covering Excel. Is there a way to force...
2
2318
by: Jim S | last post by:
To my surprise and chagrin, newer versions of Access have disabled the functionality that lets users change the data in linked tables that point to a range in an Excel workbook. This is "because of legal issues..." according to Office Support. I have other issues, specifically a couple of applications that do things such as calculate price updates in Access and read them back by means of update queries into the spreadsheets our marketing...
2
5709
by: Cele Balser | last post by:
Hello, This can't be that hard! Could someone give me the code to run a macro in my Personal.xls from my Access module? I have created a query in Access, exported it to a network drive, I can open it, but now need to format it. This is what I have, it works fine to open the Personal.xls but not run the Format_TerrListing macro. (Previous code here......) Dim oXL As Object Dim oExcel As Object Dim sFullPath As String Dim...
4
14594
by: mld01s | last post by:
Hi all!! I need help, I have been stuck for a few days on this one. I am trying to open an excel table from a command button in Access. The excel table has an auto_open macro, that is supposed to run everytime I open excel. When I navigate to the excel file, and open it, it autoruns the macro with no problems. When I go from Access hit the command, the excel table opens with no problem, but the macro does not auto run on start. Here is...
1
6205
MitchR
by: MitchR | last post by:
Good Morning Folks; I have a question that is pretty far fetched but here goes nothing... I am looking to find a way to insert a macro into an Excel command button located in an Access VBA generated Excel spreadsheet from an Access Module. I can create the spreadsheet, button, and I have the macro to insert into command button. But I am not sure how to assign the macro to the button in the access module. Set xlApp =...
0
9572
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
10562
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...
1
10303
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10070
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6845
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
5508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4282
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
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2978
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.