+ Reply to Thread
Results 1 to 4 of 4

Import part of the file name to worksheet

  1. #1
    Registered User
    Join Date
    03-22-2010
    Location
    Finland
    MS-Off Ver
    Office 365
    Posts
    23

    Import part of the file name to worksheet

    I have folder D:\Invoices. There are invoices which are named as Invoice 2000.pdf, Invoice 2001.pdf and so on. How I can get to cell C1 latest invoice number?

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Import part of the file name to worksheet

    Hello,

    This may do as you want. Withough knowing the actuall structure of the files stored in the folder and the structure there may be a couple tweeks needed.
    The code will strip out numbers from any files held in the folder .pdf .txt it wont descrimnate. meaning that if you store non invoice flies in this folder it can give a false last invoice number. Also i put the result in a public variable if you want to just use it in a single cell update this part of the code to the range in the workbook that you want. eg sheet1.range("A1")

    Please Login or Register  to view this content.
    Cheers,
    let me how how it turns out.


  3. #3
    Registered User
    Join Date
    03-22-2010
    Location
    Finland
    MS-Off Ver
    Office 365
    Posts
    23

    Re: Import part of the file name to worksheet

    Thanks. It starts well but there comes error message:
    Run-time error '438':
    Object doesn't support this property or method.

    "ws.AutoFilter.Sort.SortFields.Clear" row is yellow.

  4. #4
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Import part of the file name to worksheet

    You should be ok to remove that line of code.
    Let me know if you have trouble with changing the other parts of the code to suit your needs. If you give me the name of the sheet that you want the result to end up on put that into your next reply.

+ 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