Hi Eric,
Probably one of the parameters just not in the right place, or its type is really wrong. Try to match the parameters to your sample and check their position and type with Help for that command. You can also try to take parameters out one by one and find the wrong one. (probably some parameters cannot be omitted)
>Hi Nick,
>I have but just one problem with the code you sent me. When I run it I get
>a OLE ErrorCode of 0x80020005: Type Mismatch. Not sure what is going on...
>Also do you know a place to look up OLE Error codes. Thanks Eric
Don't know where to look at. But this one definitely refers to one of the parameters.
>
>>In general you just write the parameters in VFP style,, so False corresponds to .f., instead of Wod constants you can substitute their values from VBA Help or, better use the Word constants header file which you can download from Files Section.
>>
>>So this sample could be translated to:
>>
>>#INCLUDE w97const.h
>>oWord.ActiveDocument.MailMerge.OpenDataSource ("F:\APPS\MERGEDATA.DBF",.f.,.f.,.t.,.f.,"","","","",.f.,wdOpenFormatAuto, ;
>>"DSN=FoxPro Files - Word;UID=;PWD=;SourceDB=F:\APPS;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=MACHINE;Null=Yes;Deleted=Yes;","SELECT * FROM MERGEDATA","")
>>
>>oWord.Application.MailingLabel.DefaultPrintBarCode = .f.
>>
>>oWord.Application.MailingLabel.CreateNewDocument("","","ToolsCreateLabels1",wdPrinterManualFeed)
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison