R
raven
Hi,
Im basically try to read a part of a table from an excel file and inserting
it as an OLE object in Work. The code seems to run fine when just 1 cell is
selected, but throws a type mismatch error when the range containts multiple
cells.
My code is as follows(from word doc):
Dim excel As Object
Dim sheet As Object
dim pRange as Range
Set excel = CreateObject("Excel.Application")
Set sheet = excel.ActiveSheet
' Works fine
pRange = excel.Range(excel.Cells(1, 1), excel.Cells(1, 1))
' Throws type mismatch error
pRange = excel.Range(excel.Cells(1, 1), excel.Cells(1, 2))
pRange.InlineShapes.AddOLEObject , "c:\del.xls", , , , , , pRange
Im basically try to read a part of a table from an excel file and inserting
it as an OLE object in Work. The code seems to run fine when just 1 cell is
selected, but throws a type mismatch error when the range containts multiple
cells.
My code is as follows(from word doc):
Dim excel As Object
Dim sheet As Object
dim pRange as Range
Set excel = CreateObject("Excel.Application")
Set sheet = excel.ActiveSheet
' Works fine
pRange = excel.Range(excel.Cells(1, 1), excel.Cells(1, 1))
' Throws type mismatch error
pRange = excel.Range(excel.Cells(1, 1), excel.Cells(1, 2))
pRange.InlineShapes.AddOLEObject , "c:\del.xls", , , , , , pRange