Microsoft Office Forums

Go Back   Microsoft Office Forums > >

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

Hello,

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
Else
'do nothing
End If

Next Counter



End Sub

Thank you for your help
Reply With Quote
  #2  
Old 01-10-2019, 03:51 PM
Guessed's Avatar
Guessed Guessed is offline series letter makro 'selecting recievers' Windows 10 series letter makro 'selecting recievers' Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
  #3  
Old 01-10-2019, 05:18 PM
macropod's Avatar
macropod macropod is offline series letter makro 'selecting recievers' Windows 7 64bit series letter makro 'selecting recievers' Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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

Tags
dialog, letter, select

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
series letter makro 'selecting recievers' 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
series letter makro 'selecting recievers' 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
series letter makro 'selecting recievers' Selecting specific text out of a series of columns speedycorn1 Word 3 11-01-2010 02:58 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:06 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft