VBA Mail Merge from excel LIKE Statement

Viewed 34

I'm trying to run a mail merge from excel. below is my code but the SQL statement seems to be failing (Run-time error 4198 command failed).

  wdocSource.MailMerge.OpenDataSource _
            Name:=strWorkbookName, _
            AddToRecentFiles:=False, _
            Revert:=False, _
            Format:=wdOpenFormatAuto, _
            Connection:="Data Source=" & strWorkbookName & ";Mode=Read", _
            sqlstatement:="SELECT * FROM `Labels$` WHERE F2 LIKE '%-%' AND F3 > '0'"

Any help would be greatly appreciated

1 Answers

I realized i was missing the reference to Microsoft word library

Related