PC Review


Reply
Thread Tools Rate Thread

Calling a Sub in Personal.xls

 
 
Jim Parsells
Guest
Posts: n/a
 
      27th Nov 2008
I just can't find the right syntax.
In some workbook, I wish to call a Sub in my Personal.xls. Personal.xls is
loaded, of course, and I can use its Macros from any workbook while in Excel.
However, I cant find the right syntax to refer to Subs in that workbook from
VBA.

Help,
--
Jim Parsells
 
Reply With Quote
 
 
 
 
Jim Parsells
Guest
Posts: n/a
 
      27th Nov 2008
Nevermind --- someday I'll learn which search terms will get me what I need.
Just in case someone else wants this --

KeyVal = Application.Run("Personal.xls!SomeFunction", KeyVal, 2, 0)

You best be calling a function, because Application.Run turns all ByRef
parameters into ByVal, so you won't be returning a value in one of the
parameters.
--
Jim Parsells


"Jim Parsells" wrote:

> I just can't find the right syntax.
> In some workbook, I wish to call a Sub in my Personal.xls. Personal.xls is
> loaded, of course, and I can use its Macros from any workbook while in Excel.
> However, I cant find the right syntax to refer to Subs in that workbook from
> VBA.
>
> Help,
> --
> Jim Parsells

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      27th Nov 2008
Another option is to change the personal.xls project's name (from the generic
VBAProject) if you haven't already.

(and save your personal.xls with that new project name.)

Then use:
Select the other workbook's project.
Tools|References
and create a reference to your personal.xls project.

Then you can use the UDF just like it was built into excel:

keyval = somefunction(keyval, 2, 0)



Jim Parsells wrote:
>
> Nevermind --- someday I'll learn which search terms will get me what I need.
> Just in case someone else wants this --
>
> KeyVal = Application.Run("Personal.xls!SomeFunction", KeyVal, 2, 0)
>
> You best be calling a function, because Application.Run turns all ByRef
> parameters into ByVal, so you won't be returning a value in one of the
> parameters.
> --
> Jim Parsells
>
> "Jim Parsells" wrote:
>
> > I just can't find the right syntax.
> > In some workbook, I wish to call a Sub in my Personal.xls. Personal.xls is
> > loaded, of course, and I can use its Macros from any workbook while in Excel.
> > However, I cant find the right syntax to refer to Subs in that workbook from
> > VBA.
> >
> > Help,
> > --
> > Jim Parsells


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling SQL from code has different behaviour than calling it from MS SQL Server Management Studio jeeji Microsoft C# .NET 1 29th Jun 2006 10:43 AM
Run procedure in Personal.xls which needs name of calling workbook =?Utf-8?B?cmNtb2RlbHI=?= Microsoft Excel Programming 4 21st Sep 2005 11:16 PM
Calling a Personal.XLS Sub from anther workbook's 'This Workbook' Sheet Activate Jack Gillis Microsoft Excel Discussion 2 21st Mar 2005 11:58 PM
Server Side button calling page_load before calling it's own click event. Ryan Ternier Microsoft ASP .NET 4 29th Jul 2004 02:06 PM
Re: Calling a function without starting with "Personal!" Tom Ogilvy Microsoft Excel Programming 0 18th Jun 2004 03:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:40 PM.