Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-31-2016, 07:32 PM
macropod's Avatar
macropod macropod is offline Applications Hanging During Merge Windows 7 64bit Applications Hanging During Merge Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,375
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

The code looks alright but, if the document has been saved as a mailmerge main document, your code will stop, waiting for the SQL prompt to be responded to. You can circumvent that with:
Code:
With objWord
    .DisplayAlerts = False
    Set oDoc = objWord.Documents.Open(FileName:=fName, ConfirmConversions:=True, _
        ReadOnly:=True, AddToRecentFiles:=False, Visible:=False)
    StrSrc = "H:\PWS\Parks\Parks Operations\Sports\Sports15\DATA1\" & ws_vh.Range("B4")
    With oDoc
        With .MailMerge
            .MainDocumentType = wdDirectory
            .Destination = wdSendtToNewDocument
            .SuppressBlankLines = True
            .OpenDataSource _
              Name:=StrSrc, ReadOnly:=True, AddToRecentFiles:=False, LinkToSource:=False, _
              Connection:="Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;" & _
                "Data Source=StrSrc;Mode=Read;Extended Properties=""HDR=YES;IMEX=1"";", _
                SQLStatement:="SELECT * FROM `CORE$` WHERE [TYPE]='" & itype & "' AND [SIG_CREW]= '" & isubresp & "' ORDER BY [Start] ASC, [COMPLEX] ASC, [UNIT] ASC", _
                SQLStatement1:="", SubType:=wdMergeSubTypeAccess
            .Execute Pause:=False
        End With
        .Close False
    End With
    .DisplayAlerts = True
End With
It might also be worthwhile checking what's being passed via fName and that that file actually contains the relevant mergefields.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sharing data between Office applications mdavies Office 1 11-26-2013 02:55 PM
Applications Hanging During Merge All Office Applications lock up when saving abreeden Office 1 05-18-2012 08:02 PM
Applications Hanging During Merge VB Applications? RiverStyx Office 1 05-30-2011 08:31 PM
Change skin color of applications? Jack R Office 0 07-04-2010 04:25 AM
How many Word applications are running GetObject stevecarr Word 0 01-09-2006 07:41 AM

Other Forums: Access Forums

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