+ Reply to Thread
Results 1 to 4 of 4

VB Code to get File Name

  1. #1
    Forum Contributor
    Join Date
    01-31-2012
    Location
    Georgia
    MS-Off Ver
    Excel 2010
    Posts
    193

    VB Code to get File Name

    Hello:

    I need VB Code to get the current file name without extension in cell I3 of the opened excel file.

    Please let me know if you have any questions.
    Thanks.

    Riz

  2. #2
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,150

    Re: VB Code to get File Name

    Try this;

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    01-18-2007
    Location
    Georgia
    MS-Off Ver
    2010
    Posts
    4,434

    Re: VB Code to get File Name

    Hello Sir:

    I will be VB Macro from Within PERSONAL.xlsb where all my macros are.
    Using above gives the file name as "PERSONAL" instead of excel file which is open "Fayetteville"
    I wonder if there is way to change "ThisWorkbook" to "ActiveWorkbook"
    And it woks by changing this

    Thanks a lot

    Riz

  4. #4
    Valued Forum Contributor
    Join Date
    11-27-2011
    Location
    usa
    MS-Off Ver
    Excel 2007, Excel 365
    Posts
    495

    Re: VB Code to get File Name

    You didn't specify the sheet name so ...
    How about something like:

    FileNameWithoutExtension = Left(Range("I3"), InStrRev(Range("I3"), ".") - 1) ' Get data before last '.' in string

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] need a VBA code to open, and save a file in specific folder using cell file paths
    By JSD100 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-27-2022, 10:49 AM
  2. VBA code to insert data from multiple .txt files into one output file template file
    By psmith33 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2015, 02:49 PM
  3. Replies: 3
    Last Post: 05-21-2013, 08:22 AM
  4. Excel 2010 file with VBA save and send code works-but file can't be found.
    By carlton.clay in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-13-2013, 09:46 AM
  5. [SOLVED] VBA Code to Enter File Name, Activate the File, and Run Macro on File
    By DHartwig35805 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-09-2012, 03:49 PM
  6. [SOLVED] Import VBA Code in Excel-File ? (Export VBA Code to file)
    By Matthias Pospiech in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2005, 01:06 PM

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