Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All,
I am working on mail merge. I have access database where all the customer information are stored. I have one excel file, I have created userform. This will shows the customer information based on some criteria in listbox. User needs to select the listbox item results, may be 1 result or 10 result ( my database contains more than 500 customer information ) If the user clicks on mail merge ( in excel userform ) this perform some action. like opening word doc ( source document ) & statring merging with selected listbox item. Eg.. user selects 2 listbox items. I need mail merged letters for those clients not for all the clients ( 500 customer available in access database ). I am using the below code, which pulls out all the details not the selected listbox items. With UserForm1.ListBox1 For i = 0 To .ListCount - 1 If .Selected(i) Then litem = .List(i) Dbase = "D:\share.accdb" Ssql = "Select * FROM [" & TableName & "] " Ssql = Ssql & " WHERE ID = " & litem objword.Application.Visible = True Set cn = New ADODB.Connection cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Dbase & ";" Set rs = New ADODB.Recordset rs.Open Ssql, cn, adOpenStatic, adLockBatchOptimistic objword.MailMerge.Execute End If Next i End With |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Mail Merge source Access Database using Excel VBA | Excel Programming | |||
Advanced Mail merge invoice from excel database | Excel Discussion (Misc queries) | |||
problems using Excel as a mail merge database in Office XP | Excel Worksheet Functions | |||
mail merge with Excel data source | Excel Worksheet Functions | |||
Mail Merge from Excel Data Source to Word | Excel Programming |