Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Calling Procedures in other Projects

Subject: Calling Procedures in other Projects

Is there anyway I can call procedures in other Excel VBA projects from my
existing Excel VBA project without having to export and import the code?

VBA help gives an example of doing this under the topic of calling
procedures with the same name in different projects, but I get an "Object
Required" error when I try to duplicate the example. The example goes
something like:

Sub Main()
[MyOtherProject.XLS].[SomeModule].MyProcedure
End Sub

I've tried seeing if I could do it somehow with the Application.VBE,
VBProjects, VBComponenents, CodeModule objects, but no luck. Seems that's
only for modifying the code; not running it.

Sure would appreciate any help if anyone has some suggestions.

Thanks,


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Calling Procedures in other Projects

either
set a reference to the other project.
or
use application.run


also it may be wise to check that the function is exposed and
not private to the project or module.

easiest checked WITH a reference.
activate caller (not called) project
then open object browser and select the vbaprojectname for the called
project.

it may be handy to give your vbaprojects unique recognisable names.
iso VBAProject




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"SixSigmaGuy" wrote :

Subject: Calling Procedures in other Projects

Is there anyway I can call procedures in other Excel VBA projects from
my existing Excel VBA project without having to export and import the
code?

VBA help gives an example of doing this under the topic of calling
procedures with the same name in different projects, but I get an
"Object Required" error when I try to duplicate the example. The
example goes something like:

Sub Main()
[MyOtherProject.XLS].[SomeModule].MyProcedure
End Sub

I've tried seeing if I could do it somehow with the Application.VBE,
VBProjects, VBComponenents, CodeModule objects, but no luck. Seems
that's only for modifying the code; not running it.

Sure would appreciate any help if anyone has some suggestions.

Thanks,




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Calling Procedures in other Projects

God, that was so easy. Thank you. I used the reference method. Geezz, I
just failed to consider the obvious. Too bad they didn't mention that in
the code sample I was going by.

This allows me to have a shared code project so I don't have to make copies
in every project that all end up getting out of sync over time.

Thanks a lot!!


"keepITcool" wrote in message
...
either
set a reference to the other project.
or
use application.run


also it may be wise to check that the function is exposed and
not private to the project or module.

easiest checked WITH a reference.
activate caller (not called) project
then open object browser and select the vbaprojectname for the called
project.

it may be handy to give your vbaprojects unique recognisable names.
iso VBAProject




keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"SixSigmaGuy" wrote :

Subject: Calling Procedures in other Projects

Is there anyway I can call procedures in other Excel VBA projects from
my existing Excel VBA project without having to export and import the
code?

VBA help gives an example of doing this under the topic of calling
procedures with the same name in different projects, but I get an
"Object Required" error when I try to duplicate the example. The
example goes something like:

Sub Main()
[MyOtherProject.XLS].[SomeModule].MyProcedure
End Sub

I've tried seeing if I could do it somehow with the Application.VBE,
VBProjects, VBComponenents, CodeModule objects, but no luck. Seems
that's only for modifying the code; not running it.

Sure would appreciate any help if anyone has some suggestions.

Thanks,






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Calling Procedures in other Projects


another tip for shared code...?

centralize individual eventhandlers by using the application object's
events, so you can monitor all workbooks in the running instance from 1
place..

see
http://www.excelforum.com/showthread...hreadid=275605
be sure to follow link to chip's site.


have fun!

keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"SixSigmaGuy" wrote :

God, that was so easy. Thank you. I used the reference method.
Geezz, I just failed to consider the obvious. Too bad they didn't
mention that in the code sample I was going by.

This allows me to have a shared code project so I don't have to make
copies in every project that all end up getting out of sync over time.

Thanks a lot!!

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
VBA Sub procedures lexiez Excel Programming 2 October 4th 04 04:21 PM
Calling procedures in .xla projects Chris Excel Programming 1 July 16th 04 10:28 PM
Calling Procedures from another excel sheet by passing objects Thomas Auburn Excel Programming 0 May 5th 04 05:33 PM
Calling Procedures jrh Excel Programming 2 March 4th 04 03:34 PM
How to become a better programmer, post college. More projects or less projects. Matt Somers Excel Programming 1 February 12th 04 01:54 PM


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

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

About Us

"It's about Microsoft Excel"