From the course: Excel VBA: Managing Files and Data

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Use the built-in Open dialog box

Use the built-in Open dialog box - Microsoft Excel Tutorial

From the course: Excel VBA: Managing Files and Data

Start my 1-month free trial

Use the built-in Open dialog box

- [Instructor] When you copy or move a worksheet to another workbook, you need to provide the full path to the target workbook, where the worksheet should end up. However, you won't always know the title of that workbook, so you can't write it into your code directly. However, you can use the built-in open dialog box to identify the file and using VBA get the full path using that method. I'll demonstrate how to do that in this movie. My sample file is 04_01_OpenDialog, and that is a macro-enabled workbook you can find in the chapter four folder of your exercise files collection. I'm currently looking at a worksheet and a workbook, but I don't actually need to work with any of this data. So I will press Alt + F11 to move to the Visual Basic Editor. And here, you see that I have a code module and I have a sub-routine called GetFullPath. We're using the open dialog box, but the goal is to get the full path to a file…

Contents