Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

Open a new Doc, type some text and select to test.

Sub CopyToNewExcelWBFromDoc()

'Word
Dim objWord As Object    'Word.Application
Set objWord = GetObject(, "Word.Application")
objWord.Selection.Copy ' Select text from Word Doc

'Excel
Dim objExcel As Object, objWB As Object
Set objExcel = CreateObject("Excel.Application")
Set objWB = objExcel.Workbooks.Add
objExcel.Visible = True

'Paste into new workbook
Set wb = objExcel.ActiveWorkbook
Set ws = wb.Worksheets("Sheet1")

With ws
 .Range("A1").Select
 .Paste
End With

End Sub
  • No labels