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

Home Posts Topics Members FAQ

Application Automation : Running Embedded Code

NeoPa
32,579 Recognized Expert Moderator MVP
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 1790
NeoPa
32,579 Recognized Expert Moderator MVP
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
1750
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 Version:1.1.4322.573; ASP.NET Version:1.1.4322.573. I've changed in machine config <processmodel>, it will not time out.
2
1397
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 VB6, but the some of the differences between that and .net are like night and day. I can't believe how hard it is just trying to give the x and y axis names. The help engine is useless - even though VB.net fully support this feature. I think...
5
1670
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 assembly or COM component. Only assemblies with extension 'dll' and COM components can be referrenced". Can anybody tell me why it isn't working? It does have the extension 'dll' so I guess it is the wrong "assembly" - whatever that means!!!
3
2679
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 Controls.Add) and using the VB6 designer. In both approaches the behavior was identical: the control was functional and accessible, but the application crashed on exit with the message <app name> "has encountered a problem and needs to close. We...
3
9742
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 at the machine to cancel the process cleanly if he/she needs to. In Unix this would be a tiny shell script that used "kill -15", but under Windows there does not seem to be an easy way to do this, at least that I can find. Below is a test...
9
39454
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 ticked for the application you want to Automate. Set up an application object variable to use (You can use With...End With if you prefer). Either : Use CreateObject(Class) to open a new object for multi-instance programs (For single Instance...
0
1171
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 database in real time. How can i access that running instance of the application and has access to its OLE automation. It supports flwg functions: dim ms as object
1
2345
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 design that I am planning should support both version. Development Environment : VS2008, C# Currently Database supported are MS SQL Server 2005 and MYSQL 5 and design for database support is extensible. This application contains several high...
1
5231
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 interface' when I try to run the RegFree COM interop application from a clients machine. The application works fine for all development machines when run locally or from the network. The application is run from the network so - the component is not...
0
9589
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
10340
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
10329
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
10085
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...
1
7626
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
6858
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
5527
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...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3830
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.