View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default Get right Excel application

Set oWb = oExcel.ThisWorkbook 'ERROR 1004

I think you want:

Set oWb = oExcel.ActiveWorkbook

--
Jim
"Alex St-Pierre" wrote in message
...
| Hi !
| In Excel, when 2 differents Excel.Application, there's an error with these
| lines.
| Set oExcel = GetObject(, "Excel.Application")
| Set oWb = oExcel.ThisWorkbook 'ERROR 1004..
| Set oXlRng = oWb.Sheets(T(iTab).SheetName).Range("TableOutput")
| I'm wondering if I could just say:
| Set oXlRng =
ThisWorkbook.Sheets(T(iTab).SheetName).Range("Tabl eOutput")
| and defined oXlRng as a Range. Should I declare Excel.Range if the word
| library are open into Excel?
| Thanks!
| Alex
|
| --
| Alex St-Pierre