Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default End of Word Document and Append from Excel VB

I am currently successfully moving data from Excel to Word and now want to
use Excel VB to append several word files together (created from Excel 2003
on Windows XP Pro). I have two questions related to this.

1) I want to know how to move the insert point to the end of the Word
document I open before I insert the next document. I recorded a macro in Word
and then tried:
WordApp.ActiveDocument.Selection.EndKey Unit:=6
But it didn't work. Does anyone know what will work? Please provide code
examples.

2) I then want to insert a Word document at this end point. From that same
Word macro, I learned and planned to use:
WordApp.ActiveDocument.Selection.InsertFile Filename:="File1.doc" _
, Range:="", ConfirmConversions:=False, Link:=False,
Attachment:=False
will this work? If not what will work? Please provide code examples.

Thanks
M

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 293
Default End of Word Document and Append from Excel VB

Hi Modeerf60,

Try something along the lines of:
Dim oRng As Range
With WordApp.ActiveDocument
.Range.Characters.Last.InsertAfter vbCrLf
Set oRng = .Range.Characters.Last
oRng.InsertFile FileName:="File1.doc", ConfirmConversions:=False, Link:=False, Attachment:=False
End With

--
Cheers
macropod
[Microsoft MVP - Word]


"Modeerf60" wrote in message ...
I am currently successfully moving data from Excel to Word and now want to
use Excel VB to append several word files together (created from Excel 2003
on Windows XP Pro). I have two questions related to this.

1) I want to know how to move the insert point to the end of the Word
document I open before I insert the next document. I recorded a macro in Word
and then tried:
WordApp.ActiveDocument.Selection.EndKey Unit:=6
But it didn't work. Does anyone know what will work? Please provide code
examples.

2) I then want to insert a Word document at this end point. From that same
Word macro, I learned and planned to use:
WordApp.ActiveDocument.Selection.InsertFile Filename:="File1.doc" _
, Range:="", ConfirmConversions:=False, Link:=False,
Attachment:=False
will this work? If not what will work? Please provide code examples.

Thanks
M

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
change excel document into word document mrsb Excel Discussion (Misc queries) 6 August 28th 07 12:58 PM
convert excel document to word document (not a picture) frendabrenda1 Excel Discussion (Misc queries) 2 October 6th 06 03:55 PM
How do I convert a word document into a Excel document gwiltz2 Excel Discussion (Misc queries) 1 October 22nd 05 07:04 PM
How to change a excel document into a word document? wannaknow Excel Discussion (Misc queries) 1 July 27th 05 09:37 PM
How do I convert Word document into an Excel document? Jamie Excel Discussion (Misc queries) 3 April 7th 05 09:45 PM


All times are GMT +1. The time now is 05:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"