Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word VBA

LinkBack Thread Tools Display Modes
Old 01-10-2019, 07:49 AM
ms19 ms19 is offline Windows 10 Office 2016
Join Date: Jan 2019
Posts: 1
ms19 is on a distinguished road
Default series letter makro 'selecting recievers'


i want to finish my little project which creates letters with different texts for every adress listed in the linked excel file.

Now I want a dialog to give the users the ability to select the lines(addresses) themselves from the linked excel file. How can I realize this dialog, familiar to the dialog to select the recievers in standard series letters.

This is my code in a simplified version, because not every function is asked here. Rhe program works perfectly fine, I just need help with the selecting thing.

'### open excel file ###

Dim objXlsAppl As Object 'Excel.Application
Dim objXlsWbk As Object 'Excel.Workbook
Dim objXlsWks As Object 'Excel.Worksheet

Const pfad As String = genpath & "datensaetze.xlsm" 'Path of the xlsm

Set objXlsAppl = CreateObject("excel.application")
Set objXlsWbk = objXlsAppl.Workbooks.Open(Filename:=pfad)
objXlsAppl.Visible = False

Set objXlsWks = objXlsWbk.Worksheets("Datensätze")

'### open dialog ###
'empty, help needed

'### select lines ###
'empty, help needed

'### for selected lines create letter ###
Dim Counter

For Counter = 2 To objXlsWks.UsedRange.Rows.Count 'erste bis letzte Zeile
If haken = True Then
'do letters
'do nothing
End If

Next Counter

End Sub

Thank you for your help
Reply With Quote
Old 01-10-2019, 03:51 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,166
Guessed has a spectacular aura aboutGuessed has a spectacular aura aboutGuessed has a spectacular aura about

The Mail Merge functionality provides a dialog to allow you to select data rows. Is there a reason you aren't using this?

Doing it with VBA is way harder and would probably require two separate macros to:
  • First macro open Excel workbook
  • and then allow the user to flag the rows to be processed
  • Second macro to process the flagged rows
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Old 01-10-2019, 05:18 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,468
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold

You should be using mailmerge for this instead of VBA. Mailmerge allows you to select which records to process.
Paul Edstein
[MS MVP - Word]
Reply With Quote

dialog, letter, select

Thread Tools
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
Use L and R arrow to move cursor letter to letter, not top of the line mellowkitten Word 2 05-12-2016 07:23 PM
How to replace a letter to random letter with different color? cikanoz87 Word 7 06-18-2015 09:43 PM
VBA-Code/Makro for word file to XML Tommes93 Word VBA 2 03-31-2014 12:34 AM
Create makro that counts the number of checked tick boxes in a survey johannapaj Word VBA 0 09-05-2011 01:51 AM
Selecting specific text out of a series of columns speedycorn1 Word 3 11-01-2010 02:58 PM

All times are GMT -7. The time now is 12:03 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc. is not affiliated with Microsoft