Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
GM GM is offline
external usenet poster
 
Posts: 23
Default Making a function global

I have this function which I think that I found here. What I want to do is
make this function global so that it can be used in any workbook or
worksheet. So the question is how can I make this happen.

Function DocProps(prop As String)
Application.Volatile
On Error GoTo err_value
DocProps = ActiveWorkbook.BuiltinDocumentProperties _
(prop)
Exit Function
err_value:
DocProps = CVErr(xlErrValue)
End Function


TIA
GM
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Making a function global

make it public and put it under the Modules folder

Public Function DocProps(prop As String)
Application.Volatile
On Error GoTo err_value
DocProps = ActiveWorkbook.BuiltinDocumentProperties _
(prop)
Exit Function
err_value:
DocProps = CVErr(xlErrValue)
End Function


"GM" wrote:

I have this function which I think that I found here. What I want to do is
make this function global so that it can be used in any workbook or
worksheet. So the question is how can I make this happen.

Function DocProps(prop As String)
Application.Volatile
On Error GoTo err_value
DocProps = ActiveWorkbook.BuiltinDocumentProperties _
(prop)
Exit Function
err_value:
DocProps = CVErr(xlErrValue)
End Function


TIA
GM

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Making a function global

Create an addin and store it there.

http://support.microsoft.com/default.aspx?kbid=211563
How to create an add-in file in Excel 2000


--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"GM" wrote in message
...
I have this function which I think that I found here. What I want to do is
make this function global so that it can be used in any workbook or
worksheet. So the question is how can I make this happen.

Function DocProps(prop As String)
Application.Volatile
On Error GoTo err_value
DocProps = ActiveWorkbook.BuiltinDocumentProperties _
(prop)
Exit Function
err_value:
DocProps = CVErr(xlErrValue)
End Function


TIA
GM



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default Making a function global

To make a function accessable by any workbook the best place to put it is in
an addin. Your function causes a bit of a problem though if you send it to
anyone who does not have the addin. Application.volitile will force it to be
evaluated whenever a recalc is done and the function will return an error as
it will not be defined for them. The only effective way around that would be
to add the function within a module to each spreadsheet that you develope and
then the project will have to have a digital signature or the user will have
to enable macro's...
--
HTH...

Jim Thomlinson


"GM" wrote:

I have this function which I think that I found here. What I want to do is
make this function global so that it can be used in any workbook or
worksheet. So the question is how can I make this happen.

Function DocProps(prop As String)
Application.Volatile
On Error GoTo err_value
DocProps = ActiveWorkbook.BuiltinDocumentProperties _
(prop)
Exit Function
err_value:
DocProps = CVErr(xlErrValue)
End Function


TIA
GM

  #5   Report Post  
Posted to microsoft.public.excel.programming
GM GM is offline
external usenet poster
 
Posts: 23
Default Making a function global

Jim,
Is there an easy way to install the function into each workbook with out
going to the VB editor? I would love to just have a macro that I could
trigger and it would put it into the workbook.

THannks
GM


"Jim Thomlinson" wrote:

To make a function accessable by any workbook the best place to put it is in
an addin. Your function causes a bit of a problem though if you send it to
anyone who does not have the addin. Application.volitile will force it to be
evaluated whenever a recalc is done and the function will return an error as
it will not be defined for them. The only effective way around that would be
to add the function within a module to each spreadsheet that you develope and
then the project will have to have a digital signature or the user will have
to enable macro's...
--
HTH...

Jim Thomlinson


"GM" wrote:

I have this function which I think that I found here. What I want to do is
make this function global so that it can be used in any workbook or
worksheet. So the question is how can I make this happen.

Function DocProps(prop As String)
Application.Volatile
On Error GoTo err_value
DocProps = ActiveWorkbook.BuiltinDocumentProperties _
(prop)
Exit Function
err_value:
DocProps = CVErr(xlErrValue)
End Function


TIA
GM

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
global function Sam Excel Programming 4 July 2nd 05 01:27 AM
Making pictures global nollaig Excel Programming 2 June 2nd 05 10:51 PM
Global Function T.R. Excel Discussion (Misc queries) 1 February 16th 05 07:03 PM
Through code : Making a global change to 100 templates Ajit Excel Programming 1 August 25th 04 01:52 PM
Autofilter global Show All function disabled in protected worksheet Fartnuckles Excel Programming 1 August 18th 04 01:26 PM


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