Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


VBA and Word mail merge query options


I have a macro which execute several mail merges. I have this instruction to select the options I need for the first mail merge:

ActiveDocument.MailMerge.DataSource.QueryString = _

"SELECT * FROM `Master` WHERE ((Surname >= 'A') AND _(Surname < 'B')) ORDER BY Surname, Firstname" & ""

I need to replace the 'A' and 'B' for variables because I have to do a mail merge for each character of the alphabet. I thought I could have this:

Dim Alphabet As Variant

Alphabet = Array("A", "B", "C", ......, "Z")

I tried to replace the 'A' by Alphabet(0) and the 'B' by Alphabet(1) but it doesn't work.

Can somebody please help me? Thank you!

Josianne Marsan

Logistec Stevedoring Inc.


  • Andre YoungAndre Young USAMember Posts: 0

    _______ | | free video tutorials and ebooks about // Assembly Delphi Java Swift R Go Python Ruby C JavaScript PHP MATLAB Visual Basic .NET C# C++ Scratch Visual Basic Objective-C Perl PL/SQL Kotlin Dart ABAP COBOL Ada Crystal D Alice Logo Scheme ML VBScript SAS Transact-SQL Apex Hack Fortran Clojure Rust Bash Erlang Lisp Julia Lua FoxPro F# LabVIEW Awk Prolog Scala // ___

Sign In or Register to comment.