473,323 Members | 1,589 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Application Automation : Running Embedded Code

NeoPa
32,556 Expert Mod 16PB
Actually, the question's a little more involved than that. Let me try to explain as succinctly as I can.

I want to know how to execute code that is held within the project I'm trying to open using Application Automation.

To give an example to illustrate the concept :
I have in most of my Excel files a public function (ToA1()) that converts Rows and Columns from simple numbers to A1 notation. When I open one of these files from an Access database project, I would like to call this function from within my Access code (the part where it's working within the spreadsheet), but that is proving difficult (to say the least).

After doing some googling, I found the Application.Run() function, which allows me to execute macros (I'm guessing just subroutines), but I need it to return the value to me if possible. One negative side-effect of this for me is that ALL parameters must be passed positionally. I'm a heavy user of named arguments in my code, for reasons of clarity.

The only alternative I can see is to duplicate all my Excel routines into a separate module in my database. Not the end of the world, but not ideal either. Maintenance would be an issue, trying to avoid code getting out of synch.
Aug 14 '08 #1
1 1766
NeoPa
32,556 Expert Mod 16PB
Having completed a little more testing and experimenting (and having re-read the help section on Application.Run()), I now find that I CAN, in fact, refer to functions in this way too. The parameters are still not named but I have successfully returned the required string from my ToA1() function.

I find this an acceptable solution in the circumstances (No repeating of my Excel code inside Access databases required), but nevertheless, if anyone has any tips on accessing the code directly (without the requirement to use Application.Run()) I'd be very pleased to hear of it. I'm not sure at this stage that this is even supported, but any updates gratefully received.
Aug 14 '08 #2

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

Similar topics

3
by: Pelle | last post by:
Hi I get an System.AppDomainUnloadedException: Automation error error when the webserver has been running for a while. I'm running on windows 2000 Microsoft .NET Framework...
2
by: KC | last post by:
Does anyone, anywhere, know of a link or something that explains Excel automation in Vb.net? Specifically, details (hell, anything) on building a chart from VB.net in Excel? I found some stuff on...
5
by: Geoff Jones | last post by:
Hi I have a DLL written in C++/MFC which has functions in it. I would like to use it within a VB.net application. However, when I try to add a reference to it, I'm told that "it isn't a valid...
3
by: Asaf | last post by:
Hi, We have a VB6 application that needs to use a new control written in ..NET v1.1 C#, imported as a COM control. We have tried adding the C# control to the VB6 control both dynamically (using...
3
by: Daniel Clark | last post by:
I have a Windows command line based application that only shuts down cleanly if it sees "CTRL-C" on the console. I need to automate the running of this application, but still allow the user sitting...
9
NeoPa
by: NeoPa | last post by:
In VBA (I expect VB would be similar) controlling another Office Application (Automation) can be done using the following steps : Ensure the Reference (VBA Window / Tools / References) has been...
0
by: Diggs | last post by:
Hi, I am a newbie to .net.Need ur help in flwg: I have a 3rd party application which supports OLE automation but i do not want to create another instance, as i need to make changes in its...
1
by: abhijitbkulkarni | last post by:
Hello, I am designing a .NET database application that uses 3 tier architecture. Starting initially, this application will be desktop application but I will convert it into a website later but...
1
by: Bhrionn | last post by:
Hello World, I am working on implementing a build for my companies application. The scenario implemeted is producing the error: ‘Class does not support automation or does not support expected...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work

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.