Forum Moderators: open
I have an excel spreadsheet serving as the datasource.
I have my page template set up with the mergefield codes and logic all set. I successfully merged the datasource to the template, now I have a 570 page MS Word document. Each webpage is 3 pages long, and I have generated 190 individual webpages.
NOW.... how do I separate the pages and save them individually?
Any suggestions?
If there are only a small number of Excel lines you can go to the next to last step of the merge wizard, Preview". The use the field selection arrows in the mail merge tool bar to bring up one put the first page on the screen. Save as a text file, changing the extension to html. Advance to the next record, do Save as..., change the name of the file, type to txt, and extension to html. Keep repeating.
That would get laborous for many pages. You might be able to create a macro or VBA script to do it. You will have to include a way of changing the file name for each record save.
It may be better to find a way to automate the whole thing with VBA or Visual Basic.
NOW.... how do I separate the pages and save them individually?
I just had another thought while trying to use mail merge to produce a large number of files (not related to web work, they will be printed on paper).
To produce multiple files automatically, MS Word's mail merge would have to be given some way of naming the files, either with sequence numbers or by using one field in the data base as the file name. I don't see anything in the mail merge controls to define how the new file names will be generated, so I assume that mail merge only produces one file, with different sections, unless you are using the "directory" option. (directory option produces one line on a page for each record). There may be some forums about Microsoft Office where people would know more.
On my list of things to do when I get around to it is a VBA script to generate multiple, separate pages from a data base, perhaps using mail merge. But I have yet to get "a round toit" ;-}