LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default How to set workbook reference - basics

I'm using late binding, and for some reason I'm getting lost trying to set a
reference to a Workbook object:

Dim xlapp As Object
Dim xlwkbs As Object
Dim xlwkb As Object
Set xlapp = CreateObject("Excel.Application")
Set xlwkbs = xlapp.Workbooks

so far so good (I think), but when I try to set a reference to a Workbook, I
get a "Subscript out of range" error

Set xlwkb = xlwkbs(strPathToFile)

What I want to do is set the reference and then pass xlwkb to another
function and do stuff like add worksheets. Do I need to set the reference
differently?

Thanks in advance.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DSUM Basics Midland Excel Discussion (Misc queries) 1 August 26th 09 06:15 PM
basics? n21 New Users to Excel 7 September 21st 06 12:37 PM
Hi I'm New and need help with Excel Basics abi Excel Discussion (Misc queries) 10 November 23rd 05 07:25 PM
Reference code in another workbook from a calling workbook Datasort Excel Programming 1 January 4th 05 01:13 AM
Excel VBA basics Philipp Excel Programming 3 October 11th 04 10:11 AM


All times are GMT +1. The time now is 02:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"