473,408 Members | 1,798 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,408 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

Nov 17 '05 #1
1 1825
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
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
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...
3
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
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
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: 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
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.