By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 2,030 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

Referencing an opened Excel Workbook

P: n/a
I am writing an Module in Access 2000 that needs to reference an opened
Excel Workbook. Lets say the workbook is called Rankings.

How would I reference that workbook from within Access?

Thanks

Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I tried this:

ublic Sub MakeRSMSheets()
Dim XLApp As Excel.Application, WB As Excel.Workbook
Dim ws1 As Worksheet
Dim wsNew As Worksheet
Dim rng As Range
Dim r As Integer
Dim c As Range

Set XLApp = GetObject(, "Excel.Application")
Set WB = XLApp.Workbooks("Book1.xls")
but I get subscript out of range - however sometimes I dont get an
error. An each time, the correct workbook was opened.

-Brian

Nov 13 '05 #2

P: n/a
BerkshireGuy wrote:
I tried this:

ublic Sub MakeRSMSheets()
Dim XLApp As Excel.Application, WB As Excel.Workbook
Dim ws1 As Worksheet
Dim wsNew As Worksheet
Dim rng As Range
Dim r As Integer
Dim c As Range

Set XLApp = GetObject(, "Excel.Application")
Set WB = XLApp.Workbooks("Book1.xls")
but I get subscript out of range - however sometimes I dont get an
error. An each time, the correct workbook was opened.

-Brian


Well, if you are sure that the given workbook is the Active one, then
try this instead:

set wb = XLApp.ActiveWorkbook

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.