View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default How to call startup folder vba function?

You can't use application.Run directly as a function in a worksheet.

If you want to use a function in another workbook (using the function in a
cell), then put the function in an addin and load the addin.

Other than that, it is difficult to see what it is you are trying to do.

--
Regards,
Tom Ogilvy


Tom Corcoran wrote in message
...
"Tom Ogilvy" wrote
Application.Run "Startup.xls!Macro1"


Thanks a lot for the post. I did a search after your suggestion on working
with arguments.

My function in my vba code.xls is :

Public Function SHEETOFFSET(offset, Ref)
' Returns cell contents at Ref, in sheet offset
Application.Volatile
SHEETOFFSET = Sheets(Application.Caller.Parent.Index _
+ offset).Range(Ref.Address)
End Function

I have tried
=Application.Run("My vba code.xls!SHEETOFFSET",1,A1)+31
and the likes. I no longer am getting an error but it can't evaluate it

and
I get a #name?

I am trying it in A1 in the sheet to the left of the previous sheet where

A1
contains a valid date. Can you spot my error?

Cheers, Tom.