Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel macro to control Word Problem | Excel Programming | |||
Word Control in Excel | Excel Programming | |||
how to control word from excel | Excel Programming | |||
Print Control in Word/Excel | Excel Programming | |||
Print Control in Word/Excel | Excel Programming |