473,508 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Nov 17 '05 #1
1 1828
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 :-)

Nov 17 '05 #2

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

Similar topics

1
3953
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...
1
1211
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
1628
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
1431
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
3544
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...
3
1380
by: S.Kartikeyan | last post by:
Hello, I have a ASP.NET Page which allows the user to upload a file. What i have to do is when the user uploads a PowerPointFile i have to convert in to html and save both ppt and html...
2
2385
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);...
7
1495
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
1545
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
1307
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
7225
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
7123
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
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3194
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1557
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.