atw: Re: Office Automation VBA guru-- anyone out there to ask question of?

  • From: Michelle Hallett <michelle@xxxxxxxxxxxxxxxx>
  • To: "austechwriter@xxxxxxxxxxxxx" <austechwriter@xxxxxxxxxxxxx>
  • Date: Wed, 15 Sep 2010 11:56:05 +1000

Hi Garry,

Just had a thought, try:

Set dataFromSheet = xlApp.Run("'CTP interface macros.xls'!GetDocMetaData", 
doc.Name)

Michelle

Sent from my iPad

On 15/09/2010, at 8:33 AM, Garry Stevens <Garry.Stevens@xxxxxxxxxx> wrote:

> Note: This e-mail is subject to the disclaimer contained at the bottom of 
> this message.
> Hi All:
>  
> Thanks for the offers of help.
>  
> Problem is simple: how to return a complex value from a function call.
>  
> I call the Excel macro "GetDocMetaData" from this Word code (xlApp is a var 
> of type Excel app):
>  
> dataFromSheet = xlApp.Run("'CTP interface macros.xls'!GetDocMetaData", 
> doc.Name)
>  
> Works just fine, but I can only declare "dataFromSheet" as a simple type. At 
> the moment it's a String. Ideally I'd like to return something like this:
>  
> Type Props
>     Name As String
>     Value As String
> End Type
>  
> Dim dataFromSheet (10) As Props
>  
> This simply does not work, even with identical declarations in the Excel and 
> Word code. I'm not familiar with classes, so haven’t gone there. Tried 
> setting "dataFromSheet"  as a var of type Object. No luck.
>  
> Any help appreciated.
>  
> Garry
>  
>  
>  
> The information transmitted in this message and its attachments (if any) is 
> intended only for the person or entity to which it is addressed.
> The message may contain confidential and/or privileged material. Any review, 
> retransmission, dissemination or other use of, or taking of any action in 
> reliance upon this information, by persons or entities other than the 
> intended recipient is prohibited.
> If you have received this in error, please contact the sender and delete this 
> e-mail and associated material from any computer.
> The intended recipient of this e-mail may only use, reproduce, disclose or 
> distribute the information contained in this e-mail and any attached files, 
> with the permission of the sender.
> This message has been scanned for viruses.

Other related posts: