Is it possible to specify the path and filename of an xls file and use it as a reference without opening it?

excelos

Active Member
Joined
Sep 25, 2011
Messages
323
Is it possible to specify the path and filename of an xls file and use it as a reference without opening it?

In VBA or formulas.

Thanks!
 

Some videos you may like

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
54,405
Office Version
  1. 365
Platform
  1. Windows
Do you want the path and filename of the current active file, or some other open file?
Or do you want them to be able to browse and select a file without opening it?

If browsing for the file, you can use something like:
Code:
Dim strFileToOpen As String

strFileToOpen = Application.GetOpenFilename _
    (Title:="Please choose a file to open", _
    FileFilter:="Excel Files *.xls* (*.xls*),")
    
MsgBox strFileToOpen
See: https://analysistabs.com/vba/open-file-dialogbox-excel-macros-example-code/

For and already open activeworkbook, you can use:
Code:
MsgBox ActiveWorkbook.FullName
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,108,527
Messages
5,523,393
Members
409,515
Latest member
chemitek

This Week's Hot Topics

Top