Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default pass argument to macro

i have an application that wrote and i need to pass a string
representing an email address to my macro so it knows who to send to,
can you pass an argument to a macro?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default pass argument to macro

Sure. Include what you want inside its parentheses:

Sub test()
Call ")
Call ")
End Sub

Sub emailer(ToWhom As String)
MsgBox "mailing to " & ToWhom
End Sub


HTH. Best wishes Harald

"tommy" skrev i melding
...
i have an application that wrote and i need to pass a string
representing an email address to my macro so it knows who to send to,
can you pass an argument to a macro?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default pass argument to macro

but i'm calling the macro from a c# application so i need to send an
argument with my command to run the macro, my line that runs the macro
is this
RunMacro(excelApp, new Object[]{"'[excel file
name]'!ActiveSheet.ActiveSheet"});

so i'm trying to figure how to send the argument from that line

Harald Staff wrote:
Sure. Include what you want inside its parentheses:

Sub test()
Call ")
Call ")
End Sub

Sub emailer(ToWhom As String)
MsgBox "mailing to " & ToWhom
End Sub


HTH. Best wishes Harald

"tommy" skrev i melding
...

i have an application that wrote and i need to pass a string
representing an email address to my macro so it knows who to send to,
can you pass an argument to a macro?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default pass argument to macro

I don't think you can do that. Hopefully someone proves me wrong. Suggest
you try a C# newsgroup as well.

Apart from that, I do anything to avoid having separate apps running
separate pieces of code just to produce a single result. When I control Word
from Excel then Excel has all the code, and vice verca. A ping-pong of
macros would definitely cause trouble. So I suggest you try to do everything
from C# while you're there.

Best wishes Harald

"Tommy" skrev i melding
...
but i'm calling the macro from a c# application so i need to send an
argument with my command to run the macro, my line that runs the macro
is this
RunMacro(excelApp, new Object[]{"'[excel file
name]'!ActiveSheet.ActiveSheet"});



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default pass argument to macro

http://support.microsoft.com/default...83&Product=xlw
HOW TO: Run Office Macros by Using Automation from Visual C# .NET

see Case 1 in the sample code. It shows both with and without an argument.

--
Regards,
Tom Ogilvy

"Harald Staff" wrote in message
...
I don't think you can do that. Hopefully someone proves me wrong. Suggest
you try a C# newsgroup as well.

Apart from that, I do anything to avoid having separate apps running
separate pieces of code just to produce a single result. When I control

Word
from Excel then Excel has all the code, and vice verca. A ping-pong of
macros would definitely cause trouble. So I suggest you try to do

everything
from C# while you're there.

Best wishes Harald

"Tommy" skrev i melding
...
but i'm calling the macro from a c# application so i need to send an
argument with my command to run the macro, my line that runs the macro
is this
RunMacro(excelApp, new Object[]{"'[excel file
name]'!ActiveSheet.ActiveSheet"});





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
How do I write a macro that will allow users to set thier own pass David A. Excel Worksheet Functions 6 July 24th 07 10:48 PM
Path and Number of files in a folder. - Pass to Macro. Richard Excel Discussion (Misc queries) 1 December 21st 06 09:20 PM
Get cell address from macro function argument oscar New Users to Excel 3 June 1st 06 01:23 AM
Pass an argument to Excel workbook dorothy lo Excel Programming 2 April 22nd 04 04:05 AM
How to pass an Excel range as an argument to a SQL Server stored Procedure Belinda Excel Programming 7 April 8th 04 11:24 AM


All times are GMT +1. The time now is 11:49 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"