object - How to Insert an Excel workbook into another Excel workbook range -


i need insert 1 excel workbook excel workbook, @ same range address of 2nd workbook. have seen "selection.insertfile" method,but how can make specific range selection?

i tried:

jdt.sheets("document template").range("e44").select selection.insertfile filename:=path & fname 

but got:"object doesn't support property or method"

i realized inserting object, had use ole, unfamiliar. found , adapted answer macro yesterday, forgot come , post it, "reminder" post benefit of others:

'inserts backup template file jdt file  each cell in jdt.sheets("document template").range("e44") if isempty(cell)     dim ol oleobject     set ol = activesheet.oleobjects.add(filename:=path & fname,        link:=false,     displayasicon:=true, height:=2)    ol     .top = cell.offset(0, 1).top     .left = cell.offset(0, 1).left    end   end if next 

i realize for-next loop target 1 cell inefficient, gave me cell oriented statements useful, having spent time on this, moved on next challenge.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -