Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Passing a Reference in VBA

Hello,
I want to pass a argument to a macro to run. I have tried
application.run but can only pass numerical values. I need to pass a
string. I have been told you can add a reference in VBA to the
appropriate .xla file and was able to invoke public methods to pass the
arguments of the appropriate type. He said go to tools, references and
then add a reference.

Does anyone know how to do this?

Thanks,

Bill

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Passing a Reference in VBA

passing a string with application.run should be no problem

application.Run "MyXLA.xla!Mymacro", "abc"

as an example.

Is there something special - is the string longer than 255 characters?

--
Regards,
Tom Ogilvy


"Bill" wrote:

Hello,
I want to pass a argument to a macro to run. I have tried
application.run but can only pass numerical values. I need to pass a
string. I have been told you can add a reference in VBA to the
appropriate .xla file and was able to invoke public methods to pass the
arguments of the appropriate type. He said go to tools, references and
then add a reference.

Does anyone know how to do this?

Thanks,

Bill

*** Sent via Developersdex http://www.developersdex.com ***

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Passing a Reference in VBA

You can certainly pass string arguments using Application.Run.


Sub AAA(S As String)
Debug.Print S
End Sub

Sub BBB()
Application.Run "AAA", "abcd"
End Sub

To call methods directly from your XLA as if they were built-in
VBA functions, first open the XLA and go to the Tools menu and
choose VBA Project Properties. Change the name from VBA project
to something more meaningful. Then, choose References from the
Tools menu and put a check next to the name you gave your XLA.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Bill" wrote in message
...
Hello,
I want to pass a argument to a macro to run. I have tried
application.run but can only pass numerical values. I need to
pass a
string. I have been told you can add a reference in VBA to the
appropriate .xla file and was able to invoke public methods to
pass the
arguments of the appropriate type. He said go to tools,
references and
then add a reference.

Does anyone know how to do this?

Thanks,

Bill

*** Sent via Developersdex http://www.developersdex.com ***



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Passing a Reference in VBA


Figured it out.

Bill


*** Sent via Developersdex http://www.developersdex.com ***
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
Hyperlink - Passing a cell reference buechler66 Excel Worksheet Functions 1 July 14th 06 02:15 PM
Passing objects by value instead of by reference aspenbordr Excel Programming 7 August 4th 05 12:13 PM
passing reference arguments to VBA function Mezon Excel Programming 2 August 28th 04 04:49 PM
Passing Variables Paula[_3_] Excel Programming 1 August 23rd 04 06:55 PM
Problem passing by reference Ted[_8_] Excel Programming 10 February 23rd 04 07:27 PM


All times are GMT +1. The time now is 02:50 PM.

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"