Solved

Is there an Excel GetOpenFilename Method which returns just the filename and not the file path ?

Posted on 2014-11-12
3
92 Views
Last Modified: 2014-11-12
Hi All,

Is there a VBA method which will return me a string containing just the file name and not the full file path ?

Thanks
T
0
Comment
Question by:Tocogroup
3 Comments
 
LVL 33

Accepted Solution

by:
Rob Henson earned 500 total points
ID: 40437165
Include this line:

FileName = ActiveWorkbook.Name

Thanks
Rob H
0
 
LVL 26

Expert Comment

by:ProfessorJimJam
ID: 40437230
here it is

Sub test()
Dim f As String, OpenMsg As String, FileName As String

f = Application.GetOpenFilename(Title:="Select  File")


If f = "False" Then Exit Sub


FileName = Dir(f, vbDirectory)

MsgBox FileName

End Sub

Open in new window

0
 

Author Closing Comment

by:Tocogroup
ID: 40437232
Thanks Rob. That's great.
Toco
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question