Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Execution of an externally created VBA code
Hi,
how can I execute a VBA code in EXCEL which has been created by an external application (C Applikations such as LabWindows CVI) as ASCII code file? My C application acquires a couple of thousand numbers which I like to open in EXCEL. The C application writes an CSV-File and launches EXCEL. Now EXCEL needs to execute a VBA code to format data, created charts etc. which also has been created by the application as ASCII file (can't be a fixed makro since the formatting depends on the settings and results of my application). Once the VBA code is in EXCEL I can launch it via DDE or similar. Alternatively, can I execute VBA code transfered to EXCEL via DDE? Thanks - Reinhard |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Execution of an externally created VBA code
You can import VBA modules into an Excel project at runtime. Then execute.
You can't import and run the module from within the same procedure, so you have to call another procedure to get it to run. Example: If the file Module1.bas has a procedure called runme, then you could do the following: Sub test() ThisWorkbook.VBProject.VBComponents.Import "C:\T\Module1.bas" test2 End Sub Sub test2() runme End Sub I have examples of VBA at runtime on my website. Chip Pearson has some decent information on the topic too: http://www.cpearson.com/excel/vbe.htm -- Rob van Gelder - http://www.vangelder.co.nz/excel "Reinhard F. Bentrup" wrote in message ... Hi, how can I execute a VBA code in EXCEL which has been created by an external application (C Applikations such as LabWindows CVI) as ASCII code file? My C application acquires a couple of thousand numbers which I like to open in EXCEL. The C application writes an CSV-File and launches EXCEL. Now EXCEL needs to execute a VBA code to format data, created charts etc. which also has been created by the application as ASCII file (can't be a fixed makro since the formatting depends on the settings and results of my application). Once the VBA code is in EXCEL I can launch it via DDE or similar. Alternatively, can I execute VBA code transfered to EXCEL via DDE? Thanks - Reinhard |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Execution of an externally created VBA code
Thanks for the references, after having read through some of them I'm
wondering whether it might be even easier to directly access to the EXCEL objects out of my C application. Is this possible? Can you reference an example? Thanks - Reinhard "Rob van Gelder" schrieb im Newsbeitrag ... You can import VBA modules into an Excel project at runtime. Then execute. You can't import and run the module from within the same procedure, so you have to call another procedure to get it to run. Example: If the file Module1.bas has a procedure called runme, then you could do the following: Sub test() ThisWorkbook.VBProject.VBComponents.Import "C:\T\Module1.bas" test2 End Sub Sub test2() runme End Sub I have examples of VBA at runtime on my website. Chip Pearson has some decent information on the topic too: http://www.cpearson.com/excel/vbe.htm -- Rob van Gelder - http://www.vangelder.co.nz/excel "Reinhard F. Bentrup" wrote in message ... Hi, how can I execute a VBA code in EXCEL which has been created by an external application (C Applikations such as LabWindows CVI) as ASCII code file? My C application acquires a couple of thousand numbers which I like to open in EXCEL. The C application writes an CSV-File and launches EXCEL. Now EXCEL needs to execute a VBA code to format data, created charts etc. which also has been created by the application as ASCII file (can't be a fixed makro since the formatting depends on the settings and results of my application). Once the VBA code is in EXCEL I can launch it via DDE or similar. Alternatively, can I execute VBA code transfered to EXCEL via DDE? Thanks - Reinhard |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Execution of an externally created VBA code
Reinhard,
This article may help: http://support.microsoft.com/default.aspx?kbid=216686 -- Rob van Gelder - http://www.vangelder.co.nz/excel "Reinhard F. Bentrup" wrote in message ... Thanks for the references, after having read through some of them I'm wondering whether it might be even easier to directly access to the EXCEL objects out of my C application. Is this possible? Can you reference an example? Thanks - Reinhard "Rob van Gelder" schrieb im Newsbeitrag ... You can import VBA modules into an Excel project at runtime. Then execute. You can't import and run the module from within the same procedure, so you have to call another procedure to get it to run. Example: If the file Module1.bas has a procedure called runme, then you could do the following: Sub test() ThisWorkbook.VBProject.VBComponents.Import "C:\T\Module1.bas" test2 End Sub Sub test2() runme End Sub I have examples of VBA at runtime on my website. Chip Pearson has some decent information on the topic too: http://www.cpearson.com/excel/vbe.htm -- Rob van Gelder - http://www.vangelder.co.nz/excel "Reinhard F. Bentrup" wrote in message ... Hi, how can I execute a VBA code in EXCEL which has been created by an external application (C Applikations such as LabWindows CVI) as ASCII code file? My C application acquires a couple of thousand numbers which I like to open in EXCEL. The C application writes an CSV-File and launches EXCEL. Now EXCEL needs to execute a VBA code to format data, created charts etc. which also has been created by the application as ASCII file (can't be a fixed makro since the formatting depends on the settings and results of my application). Once the VBA code is in EXCEL I can launch it via DDE or similar. Alternatively, can I execute VBA code transfered to EXCEL via DDE? Thanks - Reinhard |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code Execution Message | Excel Discussion (Misc queries) | |||
code execution has been interrupted | Excel Discussion (Misc queries) | |||
code execution has been interrupted | Excel Discussion (Misc queries) |