Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code Execution Message canderson Excel Discussion (Misc queries) 1 October 9th 09 04:28 PM
code execution has been interrupted del Excel Discussion (Misc queries) 0 September 3rd 05 12:22 PM
code execution has been interrupted François Excel Discussion (Misc queries) 1 February 18th 05 11:06 PM


All times are GMT +1. The time now is 10:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"