The statement
Selection.Copy
is copying whatever is currently selected in Excel.
To copy the Selection
object in Word, use
objWord.Selection.Copy
It is always advisable to qualify what objects you are referring to when using methods and properties, even when VBA provides a default object.
Sub ImportSectHWord()
'It is better to always define constants, even though they will default to zero
' which just happens to be the desired value in this case
Const wdDoNotSaveChanges As Long = 0
Dim objWord As Object
Dim objDoc As Object
Dim wdFileName
Set objWord = CreateObject("word.Application")
wdFileName = Application.GetOpenFilename("Word Documents, *.doc*")
If wdFileName = False Then Exit Sub
Set objDoc = GetObject(wdFileName)
objWord.Documents.Open (wdFileName)
objWord.Selection.WholeStory
objWord.Selection.Copy
ActiveWorkbook.Worksheets("H Import").Select
ActiveWorkbook.Worksheets("H Import").Range("A1").Select
ActiveWorkbook.ActiveSheet.Paste
objDoc.Close SaveChanges:=wdDoNotSaveChanges
objWord.Quit
End Sub
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…