View Single Post
  #1   Report Post  
corquando corquando is offline
Junior Member
 
Posts: 2
Default Word merge keeps old fields

Howdy, Word-world.

MSOffice 2007, XP Pro OS.


Here's one I haven't even seen before. I don't know if it's a Word issue or Excel issue, so I'm wallpapering, here and at Mr.Excel.com.

I have a VBA program in Excel that opens a Word doc, links it to an Excel worksheet and merges. So far, kindergarten stuff.

Since I have a number of different types of docs I produce daily, each with its own set of data fields, the page I link to is populated with data particular to one style of doc, linked, merged and then deleted after the production run. Then a new page is added in the same spot, given the same name and a different set of data fields and data are loaded in.

As well, I open a new Word.App for every different source page (Set AppWd = CreateObject("Word.Application")) and then quit after each type so it's also gone.

I do that so that I don't have 17 different merge codes with one variable unique to each. Populating one sheet and running the same code is a whole lot more efficient.

Up until yesterday this worked fine - for, like, years. Then, for some reason, out of the blue, now when I open and start to process a new doc, it tries to link to the old field set, even though that page was deleted and a new one added and populated.

So, since it quits, the application should unlink but it doesn't . . . ?

Additional weirdness: When I manually open one of the docs, it tries to link to the old source page fields, regardless of whether it is the type that was last run successfully or not. This is true even after having the desktop shut down overnight.

MORE additional weirdness: If I manually Save the Excel workbook after repopulating the source page, then manually Open a new Word doc, it links fine. Sometimes I have to open the Existing Source table, sometimes not, but it always links up.

BUT . . . that doesn't work when I do an "ActiveWorkbook.Save" in the VBA code after each new source page population.

Makes my brain hurt.



Thanks to all.

Last edited by corquando : November 23rd 11 at 02:54 PM Reason: Options update