Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2008

Tip: Looking for answers? Try searching our database.

is it possible to pass a reference to a function as an argument

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SlowArrow - 28 Jan 2008 17:54 GMT
I'd like to write a vba function, referencable by an argument of a vba
subroutine.
I think, the answer is NO, but i'd like to be sure about it.
I may avoid it, but it would be nice.

Thanks, ahead:-)

SlowArrow
Jim Cone - 28 Jan 2008 18:14 GMT
Huh ?
Helpful posting advice here... http://www.cpearson.com/excel/newposte.htm
Signature

Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)

"SlowArrow"
wrote in message
I'd like to write a vba function, referencable by an argument of a vba
subroutine.
I think, the answer is NO, but i'd like to be sure about it.
I may avoid it, but it would be nice.

Thanks, ahead:-)

SlowArrow

Jim Thomlinson - 28 Jan 2008 18:16 GMT
I am a little unclear what exactly you want to do. Do you want to pass a
subroutine as an argument to a function (this would be similar to the ability
in C to pass a function as an argument). If that is what you are looking to
do then the answer is no. Perhaps a better explanation of what you would like
to accomplish will allow us to provide you with a satisfactory answer
though...
Signature

HTH...

Jim Thomlinson

> I'd like to write a vba function, referencable by an argument of a vba
> subroutine.
[quoted text clipped - 4 lines]
>
> SlowArrow
SlowArrow - 28 Jan 2008 20:22 GMT
Dear Jim,

I appreciate your effort to help me. What I was looking for, is really the
c-like calling of the subroutines:-( Such is the life;-) I've seen some signs
(but not direct statements) in the vba help, and I saw some samples on the
internet to handle vba-written callback functions (here there were also
notices, which told me a strong no). However, people always hope some more
beautiful;-)

The problem, what indicated my question is the following, shortly:
I have just written a pretty userform with the mscal.ocx to to fill a
combobox (or textbox, but this is not important) called from the control's
MouseDown event. It works, but sometimes it is not enough to fill the box
with the selected date: I have to transform it a bit somehow (for example,
instead of writing the selected date, we have to put the first day of the
week containing the selected date into the control). Instead of wiring in the
code of the Calendar userform (at least a parameterizable code), I thought a
function passing feature would be the most general and elegant. So, this is
why i wanted to be sure about it.

Thanks for your help, again:-)

SlowArrow

> I am a little unclear what exactly you want to do. Do you want to pass a
> subroutine as an argument to a function (this would be similar to the ability
[quoted text clipped - 11 lines]
> >
> > SlowArrow
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.