Solved

Extract Just Path Location from File Picker  vba Access

Posted on 2016-08-17
3
68 Views
Last Modified: 2016-08-17
vba

Using

' To extract only the filename from the path, you can do the following:
   varFilename = Mid(fDialog.SelectedItems(1), InStrRev(fDialog.SelectedItems(1), "\") + 1, Len(fDialog.SelectedItems(1)))
  

Open in new window


The Above gives me
myexcelfile.xls
from
C:\Program Files\MyData\myexcelfile.xls



What I need:
I need to extract just the file Path Location :
C:\Program Files\MyData\

This will not work: it gives me the whole file location path and name:  C:\Program Files\MyData\myexcelfile.xls



thanks
fordraiders
0
Comment
Question by:fordraiders
[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 48

Accepted Solution

by:
Dale Fye earned 500 total points
ID: 41759835
try:

varPath = LEFT(fDialog.SelectedItems(1), InStrRev(fDialog.SelectedItems(1), "\"))
0
 
LVL 26

Expert Comment

by:Shaun Kline
ID: 41759838
Try this:
   varPath = Left(fDialog.SelectedItems(1), Len(fDialog.SelectedItems(1)) - InStrRev(fDialog.SelectedItems(1), "\") - 1, )
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 41759941
Thanks dale.
0

Featured Post

Technology Partners: 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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

630 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