Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a Page Break in Word

Status
Not open for further replies.

JeaShe

Programmer
Mar 9, 2004
89
US
I'm scraping info and sending it to a Word doc. I want to be able to send data to Word and then at some point put in a page break and start a new page. It can be in the same doc, just different pages.

I use:

objDoc.Content.InsertAfter Chr$(13 ) & Chr$(10) & Chr$(13) & Chr$(10)
msgText = "Final transaction reviewed: "& TransId & "."
objDoc.Content.InsertAfter MsgText

to send data to the doc and a couple hard returns.
The cursor doesn't move during this process. I can continue to send info and it will put it at the bottom of last data. When I send a page break using: objDoc.Content.InsertBreak
it adds a new page but deletes everything before it. I'm thinking it's because it is doing break at cursor location and I don't know how to move the cursor. Any ideas??

 
You obviously know how to code in VBA, I'd suggest you run the code in VBA and use it to control Extra. You'll find the environment more familiar, and the properties and methods are more exposed.

See this FAQ:
faq99-4069

calculus
 
I see this suggestion all the time and I think I could do the VBA code, but my thought is always how I would fire the macro then... I usually have a toolbar button in the Extra session that my users click to fire the macros. Would I be able to use those buttons to fire macros in Word? The other problem I have is where to save macros. Do I save the to Normal.dot? If so, how can I distribute that to all my users? Right now it's easy to run a batch file that copies my macros to the macros folder on the C drive. Normal.dot I think resides within each user's templates folder.
 
So if I were to do it in Excel I would distribute the spreadsheet file that I save the macro in to my users?

My staff does almost all their work on the mainframe so are in Extra 100% of the time. So I do like to have the button to fire the macro in Extra. I suppose I could use an Extra macro to open the spreadsheet and fire the macro?

 
I usually use Excel, not Word. I save the VBA code in a specific Excel file.

You can set up a button that will do certain things. I'd suggest, however, that you rethink your entire process. The user obviously wants a word document as the end result. Why not have them open a Word doc as step 1, then run a macro from there that conects to Extra, does stuff and outputst the doc?

In most of my cases, the user is blissfully unaware that Extra is churning in the background. They just see the "magic" happening in their Office Doc (ususally Excel).

calculus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top