Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-23-2018, 07:26 PM
stevenel stevenel is offline Word MergeField Code Text issue Windows 7 64bit Word MergeField Code Text issue Office 2013
Novice
Word MergeField Code Text issue
 
Join Date: Jul 2018
Posts: 26
stevenel is on a distinguished road
Default Word MergeField Code Text issue

I try to modified a current spreadsheet that I did not created.

In the excel file a button was created to do these step :

Create new .CSV file
Open my Word master


Create word document with my .csv file
Close and save the .csv file.

When the word document open, they did not ask to select text code. As a default, the Japonese code is select. So cute, but not good.

Sould I change something in this ? Thank you in advance

Code:
With wdapp
        'Disable alerts to prevent an SQL prompt
        .DisplayAlerts = wdAlertsNone
        'Open the mailmerge main document
        Set wddoc = .Documents.Open("C:\Users\Test.docx")
        With wddoc
             .ActiveWindow.View.Type = wdNormalView
            With .MailMerge
                'Define the mailmerge type
                .MainDocumentType = wdDirectory
                'Connect to the data source
                .OpenDataSource Name:=strWorkbookName, ReadOnly:=True, AddToRecentFiles:=False, _
                Revert:=False, Format:=wdOpenFormatAuto, Connection:="Data Source=" _
                & strWorkbookName & ";Mode=Read", SQLStatement:="SELECT * FROM 'Sheet1'"
                .SuppressBlankLines = True
                With .DataSource
                    .FirstRecord = wdDefaultFirstRecord
                    .LastRecord = wdDefaultLastRecord
                End With
                'Define the output
                .Destination = wdSendToNewDocument
                'Excecute the merge
                .Execute
                'Disconnect from the data source
                .MainDocumentType = wdNotAMergeDocument
            End With
            'Close the mailmerge main document
            .Close False
        End With
        'Restore the Word alerts
        .DisplayAlerts = wdAlertsAll
        'Display Word and the document
        .Visible = True
    End With
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Word MergeField Code Text issue Mail Merge Code Issue Andrewwill Mail Merge 6 01-06-2018 10:25 PM
Word MergeField Code Text issue How to link Excel fields with MergeField in Word? Fabulist Mail Merge 3 02-03-2016 02:32 PM
creating a code to create dynamic text in word ah8471 Word VBA 1 12-29-2015 10:52 PM
Word MergeField Code Text issue Printing selected pages based on a MERGEFIELD.g. If MERGEFIELD=x then print pages 1,2,4 if MERGEFIEL Richard.p Word 3 04-21-2015 01:14 AM
Omit mergefield if it contains specific text MikeStewart Mail Merge 3 10-01-2014 01:31 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:29 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