View Single Post
 
Old 05-03-2017, 04:58 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,464
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

Quote:
Originally Posted by JennEx View Post
Quote:
Originally Posted by macropod View Post
... is that your macro seems to be running the merge from a different workbook than the one containing the data source.
Correct ... my 'application' workbook holds the code. It relies on a workbook serving as a database as each date has it's own. The application can call on any date to pull reports from.
Quote:
Originally Posted by macropod View Post
Furthermore, it closes the mailmerge source workbook if it's open.
I did not know that. When I go to my application worksheet, I can access the data workbook ... but ... it's hidden. If I unhide it, I have access to it as it is open. (?) Could the fact the data workbook is hidden play a role?
The code that ensures the source workbook is closed before the merge runs is:
Code:
    'close data file
    st_srchfn = "u:\PWS\Parks\Parks Operations\Sports\Sports17\DATA\" & ws_vh.Range("N2")
    If wb_nwb Is Nothing Then
        MsgBox wb_nwb & " is NOT open."
    Else
        wb_nwb.Close True 'saves data workbook after TYPE was updated for GS
    End If
Since the workbook gets closed, it doesn't matter whether it was hidden beforehand. I doubt it would matter anyway.
Quote:
Originally Posted by JennEx View Post
I would call that success. But, the 'Page of Pages' still refuses to populate. This is what I find to be most mysterious. If you refer to the document created by the macro launched merge in post 9 (https://drive.google.com/file/d/0B9E...ew?usp=sharing) with the file you provided, these merge fields populate although I have more than one record per page.
But with the code changes I suggested in my last post (post #14), you should now be getting one page per record. And, hopefully, the correct 'Page of Pages' output; if not, what is the incorrect 'Page of Pages' output you're getting?
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote