Solved

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

Posted on 2014-11-12
3
85 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 31

Accepted Solution

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

FileName = ActiveWorkbook.Name

Thanks
Rob H
0
 
LVL 25

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now