+ Reply to Thread
Results 1 to 9 of 9

displaying a filename in TextBox

  1. #1
    Forum Contributor CobraLAD's Avatar
    Join Date
    07-23-2007
    Location
    Boksburg, South Africa
    MS-Off Ver
    Office 2019
    Posts
    346

    displaying a filename in TextBox

    Hi

    I want to use this code to display only the filename + extension in the TextBox1. It currently shows the full path

    Please Login or Register  to view this content.
    Last edited by CobraLAD; 04-21-2009 at 12:19 AM.

  2. #2
    Registered User
    Join Date
    04-16-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: displaying a filename in TextBox

    Try with the following, I am hope it will be useful to you

    Please Login or Register  to view this content.
    Last edited by VBA Noob; 04-20-2009 at 08:36 AM.

  3. #3
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: displaying a filename in TextBox

    Try:-
    Please Login or Register  to view this content.
    Regards Mick

  4. #4
    Forum Contributor CobraLAD's Avatar
    Join Date
    07-23-2007
    Location
    Boksburg, South Africa
    MS-Off Ver
    Office 2019
    Posts
    346

    Re: displaying a filename in TextBox

    Thanks MickG

    Is there a way to specify a specific file type. I want to only open jgp files

  5. #5
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: displaying a filename in TextBox

    Hi, Do you mean "jpg" or "jgp" ??
    I think the easiest way is as below, but there is some Code in Vb Help Under "FiledialogFilters Collection".
    Please Login or Register  to view this content.
    Regards Mick

  6. #6
    Forum Contributor CobraLAD's Avatar
    Join Date
    07-23-2007
    Location
    Boksburg, South Africa
    MS-Off Ver
    Office 2019
    Posts
    346

    Re: displaying a filename in TextBox

    Sorry Mick, it was jpg files.

    This works fine, but how will I use the code without Dir, so that the full path with the filename shows in the TextBox.

  7. #7
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: displaying a filename in TextBox

    Hi, Just remove the "Dir" !!

    Please Login or Register  to view this content.
    Regards Mick
    End If

  8. #8
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: displaying a filename in TextBox

    Another method - this will only Display JPG files
    Selection for only 1 file at a time



    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  9. #9
    Forum Contributor CobraLAD's Avatar
    Join Date
    07-23-2007
    Location
    Boksburg, South Africa
    MS-Off Ver
    Office 2019
    Posts
    346

    Re: displaying a filename in TextBox

    thanks all

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1