LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Control Word through Excel

1. I am opening Word through Excel (No problem)
2. Adding a new document in Word (No problem)
3. Trying to insert Wordfiles stored on disc into new created document by:

oDoc.Selection.InsertFile FileName:=MyFile, Link:=False

The program does not accept the line above. Why?

Here is the total program:
Sub InsertWordFiles()
'Inserts all Wordfiles in "C:\Temp" into a new created Worddocument
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim MyFile As String

'Open Word and add a new document
Set oWord = CreateObject("Word.Application")
oWord.Visible = True
oWord.Activate
Set oDoc = oWord.Documents.Add

'Add all Wordfiles in "C\Temp" into new created Wordfile
ChDir "C:\Temp"
MyFile = Dir("*.doc")
Do
oDoc.Selection.InsertFile FileName:=MyFile, Link:=False
MyFile = Dir
Loop Until MyFile = Empty
End Sub
 
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
Excel macro to control Word Problem Dave R[_3_] Excel Programming 5 July 31st 04 10:35 PM
Word Control in Excel Stuart[_5_] Excel Programming 10 July 11th 04 08:47 PM
how to control word from excel Torstein S. Johnsen[_2_] Excel Programming 1 February 10th 04 02:10 PM
Print Control in Word/Excel Charles Maxson Excel Programming 0 December 30th 03 08:55 PM
Print Control in Word/Excel losmac[_2_] Excel Programming 0 December 30th 03 08:22 PM


All times are GMT +1. The time now is 02:54 PM.

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

About Us

"It's about Microsoft Excel"