Hi Guys....
I'm using Office 2010 under Windows 7.
I have a number of mailmerge template documents which I wish to populate using VBA.
Each template starts off with an image (the Company logo), then has the mailmerge fields for the Customer details, then some text, the number of lines in which varies with the template.
I have some VBA code in the template which fires after the mailmerge.
The VBA opens an Excel spreadsheet, reads product data in order to populate various listboxes on a Userform, then allows the User to select a variable number of Products.
All this is working just fine.
My next goal, having saved the selected product details in an array, is to write the array as a list to the bottom of the template document.
Again, I can achieve that quite easily.
The problem is that I'd like to be able to determine when I've got one line left on the page, and more than one Product line still to write.
In that situation I'd like to use the last line on Page 1 to say "(Continued overleaf)", then continue writing the products list on the next page.
In order to achieve this I need to be able to work out exactly how many lines are left on the document before an automatic page break will be triggered.
This means I have to know where my first line will go on the page, i.e. on what line does the basic template's text end.
I've read up about font sizes, and the 120% rule for single spaced text lines, and how to determine the document size, so if I knew which line I was startin on I could work out how many lines were left on the page and act accordingly.
My problem is that I can't seem to find any VBA which will tell me the location of the current end point of the template in terms of the number of lines used, or the distance down the page in points (or any other measurements).
Can any kind soul point me in the right direction? I'm reasonably competent with VBA, but more so in Excel, which seems to have richer functions than thos in Word.
Any assistance would be gratefully appreciated....