PC Review


Reply
Thread Tools Rate Thread

access object in non-referenced add-in

 
 
Robert Schwenn
Guest
Posts: n/a
 
      18th Feb 2008
Hi,

in a thread a few days ago we saw, that a function of another add-in can be
called (without a reference to that add-in) in this way:

s = Application.Run("myAddin.xla!fct_name", arg1, arg2)

But how can be gained access to a public object variable of another plugin?
(It seems, that there cannot be returned an object via Application.Run)


Robert
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      18th Feb 2008
First, if you use application.run, you don't need a reference to that other
addin's project.

Second, you can create a function in the addin that returns an object. Then you
can call that function.

Robert Schwenn wrote:
>
> Hi,
>
> in a thread a few days ago we saw, that a function of another add-in can be
> called (without a reference to that add-in) in this way:
>
> s = Application.Run("myAddin.xla!fct_name", arg1, arg2)
>
> But how can be gained access to a public object variable of another plugin?
> (It seems, that there cannot be returned an object via Application.Run)
>
> Robert


--

Dave Peterson
 
Reply With Quote
 
Robert Schwenn
Guest
Posts: n/a
 
      18th Feb 2008
Dave Peterson schrieb:
> First, if you use application.run, you don't need a reference to that other
> addin's project.
>
> Second, you can create a function in the addin that returns an object. Then you
> can call that function.


Ok, I was wrong: You *can* return an object by the function.

Thats why the next question: This works inside Excel. But when I run the
function from a vbscript (that is what I want), I get a runtime error, if the
function returns an object (other return types are ok):

set xl = CreateObject("Excel.Application")
set dummy = xl.Run("myAddin.xla!fct_name", arg1, arg2) 'runtime error

Robert


>
> Robert Schwenn wrote:
>> Hi,
>>
>> in a thread a few days ago we saw, that a function of another add-in can be
>> called (without a reference to that add-in) in this way:
>>
>> s = Application.Run("myAddin.xla!fct_name", arg1, arg2)
>>
>> But how can be gained access to a public object variable of another plugin?
>> (It seems, that there cannot be returned an object via Application.Run)
>>
>> Robert

>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      18th Feb 2008
Are you sure you loaded myAddin.xla?



Robert Schwenn wrote:
>
> Dave Peterson schrieb:
> > First, if you use application.run, you don't need a reference to that other
> > addin's project.
> >
> > Second, you can create a function in the addin that returns an object. Then you
> > can call that function.

>
> Ok, I was wrong: You *can* return an object by the function.
>
> Thats why the next question: This works inside Excel. But when I run the
> function from a vbscript (that is what I want), I get a runtime error, if the
> function returns an object (other return types are ok):
>
> set xl = CreateObject("Excel.Application")
> set dummy = xl.Run("myAddin.xla!fct_name", arg1, arg2) 'runtime error
>
> Robert
>
> >
> > Robert Schwenn wrote:
> >> Hi,
> >>
> >> in a thread a few days ago we saw, that a function of another add-in can be
> >> called (without a reference to that add-in) in this way:
> >>
> >> s = Application.Run("myAddin.xla!fct_name", arg1, arg2)
> >>
> >> But how can be gained access to a public object variable of another plugin?
> >> (It seems, that there cannot be returned an object via Application.Run)
> >>
> >> Robert

> >


--

Dave Peterson
 
Reply With Quote
 
Robert Schwenn
Guest
Posts: n/a
 
      19th Feb 2008
Dave Peterson wrote:
> Are you sure you loaded myAddin.xla?
>

Absolutely.
The runtime error only occurs, if the function should return an object type.

>
>
> Robert Schwenn wrote:
>> Dave Peterson schrieb:
>>> First, if you use application.run, you don't need a reference to that other
>>> addin's project.
>>>
>>> Second, you can create a function in the addin that returns an object. Then you
>>> can call that function.

>> Ok, I was wrong: You *can* return an object by the function.
>>
>> Thats why the next question: This works inside Excel. But when I run the
>> function from a vbscript (that is what I want), I get a runtime error, if the
>> function returns an object (other return types are ok):
>>
>> set xl = CreateObject("Excel.Application")
>> set dummy = xl.Run("myAddin.xla!fct_name", arg1, arg2) 'runtime error
>>
>> Robert
>>
>>> Robert Schwenn wrote:
>>>> Hi,
>>>>
>>>> in a thread a few days ago we saw, that a function of another add-in can be
>>>> called (without a reference to that add-in) in this way:
>>>>
>>>> s = Application.Run("myAddin.xla!fct_name", arg1, arg2)
>>>>
>>>> But how can be gained access to a public object variable of another plugin?
>>>> (It seems, that there cannot be returned an object via Application.Run)
>>>>
>>>> Robert

>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      19th Feb 2008
I don't have any more guesses based on what you've shared.

Robert Schwenn wrote:
>
> Dave Peterson wrote:
> > Are you sure you loaded myAddin.xla?
> >

> Absolutely.
> The runtime error only occurs, if the function should return an object type.
>
> >
> >
> > Robert Schwenn wrote:
> >> Dave Peterson schrieb:
> >>> First, if you use application.run, you don't need a reference to that other
> >>> addin's project.
> >>>
> >>> Second, you can create a function in the addin that returns an object. Then you
> >>> can call that function.
> >> Ok, I was wrong: You *can* return an object by the function.
> >>
> >> Thats why the next question: This works inside Excel. But when I run the
> >> function from a vbscript (that is what I want), I get a runtime error, if the
> >> function returns an object (other return types are ok):
> >>
> >> set xl = CreateObject("Excel.Application")
> >> set dummy = xl.Run("myAddin.xla!fct_name", arg1, arg2) 'runtime error
> >>
> >> Robert
> >>
> >>> Robert Schwenn wrote:
> >>>> Hi,
> >>>>
> >>>> in a thread a few days ago we saw, that a function of another add-in can be
> >>>> called (without a reference to that add-in) in this way:
> >>>>
> >>>> s = Application.Run("myAddin.xla!fct_name", arg1, arg2)
> >>>>
> >>>> But how can be gained access to a public object variable of another plugin?
> >>>> (It seems, that there cannot be returned an object via Application.Run)
> >>>>
> >>>> Robert

> >


--

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
can every object be serialized even with referenced object within in a complex scenario Tony Johansson Microsoft C# .NET 2 5th Mar 2010 04:27 PM
Fw: Referenced COM Object Versus Dynamic Load Of COM Object Claire Microsoft C# .NET 2 9th Oct 2008 03:17 AM
Referenced Object sandy Microsoft C# .NET 5 13th Aug 2008 01:38 PM
Referenced object on subform gets "object doesn't support this property or method" Brandon Schultz Microsoft Access Forms 1 1st Feb 2007 05:06 PM
Referenced object versus copy of object OpticTygre Microsoft VB .NET 4 18th Mar 2006 02:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:37 PM.