get other workbook objects values

  • Thread starter Thread starter baha17
  • Start date Start date
B

baha17

Hi,
I wanna run the code which will read it through other workbook.But
following command giving an error
For Each Sht In Workbooks("H:\Copy of GSM ROSTER.xls").Sheets . how
can I read the other workbook object without copy. by the way when my
sheet opens,it opens Copy o ("H:\Copy of GSM ROSTER.xls" as read
only.Any idea how to refer to new open table.
Thanks for the help
 
Don't put the full path name in the Workbooks collection index. Instead, use
just the unqualified file name with no drive or path info. E.g.,

For Each Sht In Workbooks("Copy of GSM Roster.xls").Sheets

Or, you can use a Workbook reference when you open the file. E.g.,

Dim WB As Workbook
Set WB = Application.Workbooks.Open("H:\Copy Of GSM Roster.xls")
For Each Sht In WB.Sheets


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
Don't put the full path name in the Workbooks collection index. Instead, use
just the unqualified file name with no drive or path info. E.g.,

For Each Sht In Workbooks("Copy of GSM Roster.xls").Sheets

Or, you can use a Workbook reference when you open the file. E.g.,

Dim WB As Workbook
Set WB = Application.Workbooks.Open("H:\Copy Of GSM Roster.xls")
For Each Sht In WB.Sheets

--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
    Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLCwww.cpearson.com
(email on web site)






- Show quoted text -

Thanks chip,
it works perfect,
have a nice day
regards,
baha
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top