Hi Garry I'd try a couple of things: 1. test the code working without having to run the macro - ie just retrieving a value, or series of values from the Excel workbook. 2. gradually add complexity back into the call - this should help you work out whether the problem lies in how you have declared the variables, or how you are calling the macro, or how Excel regards the data returned from the macro. Just because it looks, walks and talks like a duck, doesn't mean Excel thinks it is after the data has been processed. That's what I do when I get stuck, take back to stupid simple basics - and get it working at some level, rather than at the big picture level. I'd say your hunch that it is how the variables are declared is the issue, so test it - and try not specifying the type of object, and maybe take the Prop Type out of the picture - ie just declare: Dim Value, Dim Name, Dim dataFromSheet (10) Word will treat it as a generic variable - which is not that efficient but, for now we just want to get the code to work. You can make it more efficient later. If you want to post it to me off-list I'm happy to have a look at it. These things can be pesky to track down, but usually it's a simple solution. Regards Suzy Suzy Davis Microsoft Word Templates & Documentation Projects Create Space Email suzy.davis@xxxxxxxxxxxxxxxxxx On Tue Sep 14 17:33:07 CDT 2010, 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. > _______________________________________________________________________________________ >