Solved

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

Posted on 2014-11-12
3
96 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
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.

734 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