VBA Identify Workbook

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to write a macro that resides in workbook A. Using
Set fromarea = Application.InputBox("Where is the source
data?", , , , , , , 8)
fromarea.parent.name gives me the name of the worksheet
that I referenced (in another workbook). I need a way to
identify the workbook name as well. It is not
activeworkbook or thisworkbook.

Thanks.
 
Hi

It's strictly hierarchial:
fromarea.parent.parent.name
(or path or fullname or whatever WB property)

HTH. Best wishes Harald
 
fromarea.parent.parent.name Or fromarea.worksheet.parent.name

will give you the workbook name.
 

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