ukemike
04-13-2005, 08:03 AM
Hi guys,
Its me again. I appreciate all the help from this forum. It seems like finding answers to VBA questions takes forever on the internet.
Anyway, i am generating a report from access into a word document. Im writing line by line using:
ObjWord.Selection.TypeText Text:="xxxxxxx"
Im reading the information from the database. For each record that i read i have to write two lines in the word document.
So i basically do:
ObjWord.Selection.TypeText Text:="Record1FirstPart" & vbCrLf
ObjWord.Selection.TypeText Text:="Record1SecondPart" & vbCrLf
ObjWord.Selection.TypeText Text:="Record2FirstPart" & vbCrLf
ObjWord.Selection.TypeText Text:="Record2SecondPart" & vbCrLf
and so on.
The problem is that when the document goes to the next page, I do not want the first line of record one being on one page and the second part being on the second page. I was thinking about hardcoding and counting the amount of lines per page, but then i change the font size so that would be different.
Anyway have any ideas on how i can "Test" if there is enough room left on a page for the next two lines?
Or maybe someone knows a better workaround this.
Thank you very much
Mike
Its me again. I appreciate all the help from this forum. It seems like finding answers to VBA questions takes forever on the internet.
Anyway, i am generating a report from access into a word document. Im writing line by line using:
ObjWord.Selection.TypeText Text:="xxxxxxx"
Im reading the information from the database. For each record that i read i have to write two lines in the word document.
So i basically do:
ObjWord.Selection.TypeText Text:="Record1FirstPart" & vbCrLf
ObjWord.Selection.TypeText Text:="Record1SecondPart" & vbCrLf
ObjWord.Selection.TypeText Text:="Record2FirstPart" & vbCrLf
ObjWord.Selection.TypeText Text:="Record2SecondPart" & vbCrLf
and so on.
The problem is that when the document goes to the next page, I do not want the first line of record one being on one page and the second part being on the second page. I was thinking about hardcoding and counting the amount of lines per page, but then i change the font size so that would be different.
Anyway have any ideas on how i can "Test" if there is enough room left on a page for the next two lines?
Or maybe someone knows a better workaround this.
Thank you very much
Mike