N
Nicolas Roth
Hello,
I have the following issue: i'd like, from excel, to open a word file,
copy the entire content (plain text), and then copy it into a text box
in excel.
I have written the following code, however nothing happens when I
execute it and I can't find what is wrong.. Thanks for your help,
Nicolas
Public Sub DonnéesWordVersExcel()
Dim wdDoc As Word.Document
Dim AppWord As Word.Application
Set AppWord = New Word.Application
AppWord.ShowMe
AppWord.Visible = True
Set wdDoc = AppWord.Documents.Open("c:\hello.doc", ReadOnly:=False)
With AppWord
.Selection.WholeStory
myTxt = .Selection
End With
Windows("wordtest.xls").Activate
Sheets("Sheet1").Activate
ActiveSheet.Shapes("Text Box 16").Select
Selection.Characters.Text = myTxt
Cells(16, 2).Select
'ThisWorkbook.Worksheets("Sheet1").Paste
AppWord.Application.Quit
End Sub
I have the following issue: i'd like, from excel, to open a word file,
copy the entire content (plain text), and then copy it into a text box
in excel.
I have written the following code, however nothing happens when I
execute it and I can't find what is wrong.. Thanks for your help,
Nicolas
Public Sub DonnéesWordVersExcel()
Dim wdDoc As Word.Document
Dim AppWord As Word.Application
Set AppWord = New Word.Application
AppWord.ShowMe
AppWord.Visible = True
Set wdDoc = AppWord.Documents.Open("c:\hello.doc", ReadOnly:=False)
With AppWord
.Selection.WholeStory
myTxt = .Selection
End With
Windows("wordtest.xls").Activate
Sheets("Sheet1").Activate
ActiveSheet.Shapes("Text Box 16").Select
Selection.Characters.Text = myTxt
Cells(16, 2).Select
'ThisWorkbook.Worksheets("Sheet1").Paste
AppWord.Application.Quit
End Sub