View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Calling an Excel/VBA User Created Module from WSH



It looks like your function's code is located in the sheet's object
code module. Do you know the difference between object code modules and
normal modules?

if you dont..

stick to following as a general guideline:

move all subs and functions to normal code module(s)
with the exception of eventhandlers, which must stay
in the object modules (This Workbook, Sheet1,Sheet2 etc..)

buy and study a decent book. VBA is a lot more fun in you know the
basics.

hmm... that sounds harsh.. but it's true :)


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


None wrote :

"Chip Pearson" wrote in news:eE1stOGQFHA.1096
@tk2msftngp13.phx.gbl:

Try,

Dim Result
Result = objXL.Run("test")


Hi Chip

Thanks for the reply. Unfortunately this won't work because a
parameter must be passed to this function. After many hours of trial
and error, I moved the function under the 'Sheet1' object and called
the function in this manner:

tmp = ObjXL.WorkSheets("Sheet1").getValue("Hello")

It worked. :)

Take care