none
VBA TO REMOVE FILE EXTENSION RRS feed

  • Question

  • does anyone know vba to remove file extension

    ex: I want 'fudd plans.pdf' to read as 'fudd plans'

    thanks

    Doug

    Tuesday, July 25, 2017 5:19 PM

Answers

  • got it...used:

    Sub CONTENTS()
    Dim objFSO As Object
    Dim objFolder As Object
    Dim objFile As Object
    Dim i As Integer
    MYPATH = MYPATHIS()
    FNAME = MYPATH & "ESTIMATE PLANS & DOC'S\" & TextBox107.Value
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFolder = objFSO.GetFolder(FNAME)

    For Each objFile In objFolder.Files
    FileName = CreateObject("Scripting.FileSystemObject").GetBaseName(objFile) '<<<this line worked
    ComboBox10.AddItem FileName
    'ComboBox10.AddItem objFile.Name
    Next objFile
    End Sub

    • Marked as answer by 6da4 Tuesday, July 25, 2017 6:53 PM
    Tuesday, July 25, 2017 6:53 PM