A
AA
You need to select the distinct customers from the csv
file before doing the main merge. This code should get you
most of the way there:
The [ ] and comment lines are where you need to make
changes- replace the [] too. I assumed that your CSV file
has column names.
Sub xx()
Cnn="Provider=MSDASQL;Driver={Microsoft Text Driver
(*.txt; *.csv)};DBQ=c:\[YOUR LOCATION];"
Sql="Select distinct(customer)[ add other columns
separated by ,] from [YOUR FILE NAME]"
Set ADORS=CreateObject("ADODB.Recordset")
ADORS.Open Sql,Cnn
' Open a text file here with handle FileHwnd
While NOT ADORS.EOF
print FileHwnd,ADORS.GetString
wend
'Close file here (its tab delimited)
'Read in Excel & save as csv under a new name as xls.
Mailmerger with existing Word setup & new excel file
file before doing the main merge. This code should get you
most of the way there:
The [ ] and comment lines are where you need to make
changes- replace the [] too. I assumed that your CSV file
has column names.
Sub xx()
Cnn="Provider=MSDASQL;Driver={Microsoft Text Driver
(*.txt; *.csv)};DBQ=c:\[YOUR LOCATION];"
Sql="Select distinct(customer)[ add other columns
separated by ,] from [YOUR FILE NAME]"
Set ADORS=CreateObject("ADODB.Recordset")
ADORS.Open Sql,Cnn
' Open a text file here with handle FileHwnd
While NOT ADORS.EOF
print FileHwnd,ADORS.GetString
wend
'Close file here (its tab delimited)
'Read in Excel & save as csv under a new name as xls.
Mailmerger with existing Word setup & new excel file