Unopened workbook values

A

Amuel Pouart

Is it possible to know the name of a sheet in a workbook without opening the
file?

Or is it possible to get values from a closed workbook - using the
ExecuteExcel4Macro command, for instance - and not knowing the name of the
sheets? - This function requires, as long as I know, that you use the names
of the sheets, and not their numbers.

Thanks

Sam
(e-mail address removed)
 
A

Amuel Pouart

That's true.

However there are serious resons why I don't want the workbooks to be
opened. (My macro is analysing the workbook to check if it can import data
and I don't want any other macro to start on open.)
 
R

Ron de Bruin

If you open a workbook you can use this to stop code to run.

Dim wb As Workbook
Application.EnableEvents = False
Set wb = Workbooks.Open("C:\Data\book1.xls")
' do your things
wb.Close
Application.EnableEvents = True
 

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

Top