Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-05-2014, 08:59 AM
taylorblu taylorblu is offline VBA to automatically sort items based on Mail Merge field Windows 8 VBA to automatically sort items based on Mail Merge field Office 2013
Novice
VBA to automatically sort items based on Mail Merge field
 
Join Date: Sep 2014
Posts: 2
taylorblu is on a distinguished road
Default VBA to automatically sort items based on Mail Merge field

I have a quote mail merge template that contains products. In the source, Dynamics CRM, each product contains a sequence number (field). The user is able to modify the order of the products and CRM will adjust the sequence number accordingly. The problem is when the quote is printed, the order of the products always revert back to the original order in which they were entered and not by the sequence number.

In Word, you can manually set the order by opening the 'Edit Recipient List', find the quote_product_sequence_number field column, and sort. But I need this to be automated.

I tried recording a macro as I walked through the manual steps, but the macro does not record anything when the 'Edit Recipient List' dialog box is open.

I tried adding this code ... but I get an 'object required' error.
Sub SequenceOrder()

' Sort by Sequence


sequence = ActiveDocument.MailMerge.DataSource.DataFields("Qu ote_Product_Sequence_Number").Value
sequence.Value.Sort SortOrder:=wdSortOrderAscending

End Sub

Any ideas?
Reply With Quote
 

Tags
mail merge, vba in microsoft word



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail merge how to link mail merge field value to a column heading dsummers Mail Merge 1 05-08-2014 02:59 PM
VBA to automatically sort items based on Mail Merge field How to ignore a mail merge field if the field is blank redzan Mail Merge 1 05-16-2013 08:34 AM
VBA to automatically sort items based on Mail Merge field Automatically split Mail Merge based on number of pages SaneMan Mail Merge 1 12-03-2011 01:11 AM
dynamic charts based on mail merge fields jwajehee Mail Merge 0 10-05-2011 09:47 AM
VBA to automatically sort items based on Mail Merge field Selecting merge field based on whether or not text is present amym Mail Merge 1 12-07-2010 05:14 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:42 AM.


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