473,387 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

MSOffice Programming (Word) help

Hi everyone,
Hope the MVPs for Office can help me out here.
Programming the word object is new to me. Basically, what i need to do is...
1) Open a template word document.
2) Menu->Insert->File (Another word Document)
3) Page Break
4) Repeat Step 2 for another file
5) Page Break
6) Save

i was succesfully in Inserting the new WordFile, but cant page break and
insert the next file. i always only get the latest file which i inserted
as the final product.
any samples, links which i can refer to will be very helpful

what i have now:

objWord = New Word.Application()
objWord.Documents.Open("C:\before.doc")
objWordDocument = objWord.ActiveDocument
With objWordDocument
.Range.InsertFile("C:\Word\Blah\File1.doc")
.Range.MoveEnd()
.Range.Collapse(0)
.Range.InsertBreak(7)
.Range.InsertFile("C:\Word\Blah\File2.doc")
.SaveAs("C:\after.doc")
End With

thanks in advance

Jul 21 '05 #1
1 3943
Hi Steven,
Hope the MVPs for Office can help me out here.
Programming the word object is new to me. Basically, what i need to do is...
1) Open a template word document.
2) Menu->Insert->File (Another word Document)
3) Page Break
4) Repeat Step 2 for another file
5) Page Break
6) Save

i was succesfully in Inserting the new WordFile, but cant page break and
insert the next file. i always only get the latest file which i inserted
as the final product.
any samples, links which i can refer to will be very helpful

Try

objWord = New Word.Application()
objWord.Documents.Open("C:\before.doc")
objWordDocument = objWord.ActiveDocument
With objWordDocument
.Range.InsertFile("C:\Word\Blah\File1.doc")
.Range.Collapse(0)
.Range.InsertBreak(7)
.Range.Collapse(0)
.Range.InsertFile("C:\Word\Blah\File2.doc")
.SaveAs("C:\after.doc")
End With
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan 24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: R Reyes | last post by:
Hi, what is the best way to manipulate MSOffice programs? i understand that regular web pages do not have the permissions (because of safety measures) to open up MS word/excel programs, for...
5
by: R Reyes | last post by:
Hi, no one answered so I thought reposting would get this some attention... What is the best way to manipulate MSOffice programs? I understand that regular web pages do not have certain...
1
by: srinivas | last post by:
Hi, I created an interactive html page by saving an excel file.What i need is, i created this file using office 2000.some of our clients are unable to access my page.when ever they attempt to...
18
by: Simon Morgan | last post by:
Hi, Does anybody have a solution or a hint for Exercise 5 of Chapter 15 of K.N. King's book C Programming: A Modern Approach? I spent all of yesterday evening staring at it and drooling. The...
2
by: Merighi | last post by:
Im' trying to add a textbox to a word document with this code: appWord.ActiveDocument.Shapes.AddTextbox(myOrientation,10,567,50,156,ref falseObject).Select(ref falseObject);...
1
by: steven chong | last post by:
Hi everyone, Hope the MVPs for Office can help me out here. Programming the word object is new to me. Basically, what i need to do is... 1) Open a template word document. 2) Menu->Insert->File...
7
by: Michael | last post by:
Hey, I'm, I guess, an itermediate programmer and I have a question about learning any programming language. I understand that as a programmer you're going to probably constantly be re-writing code...
3
by: Rsmastermind | last post by:
Dear all I am having the setup file of Msoffice-2007 but when I installed it had given an error that was shown in flash so I cant describe the error.Now when I am opening the Msoffice application it...
1
by: =?Utf-8?B?a2F3aXNo?= | last post by:
hi i have some problam in msoffice documents, problam is.... i m open ms word or ms excel file but it asking file conversion n i dont see my save document... my documents save in english language...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.