Strip document name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave

    Strip document name

    I have a folder which contains *.doc files. What I want to do is strip
    out the name of the doc and put the first part in a column in a table and
    the second part in another column of the table then move the doc to another
    file. Once I have done this I want to go through all the other files doing
    the same.
    My file name is something like "EX0001-123456"
    EX0001 will go in column 1 of tblfiles and 123456 will go in column 2 of the
    table.

    Can any one help me in the vba required to do this?

    Thanks in advance
    Dave


  • PC Datasheet

    #2
    Re: Strip document name

    Look at the Dir function in the Help file to retrieve file names from a folder.
    Look at the Instr function in the Help file to break the file name into two
    parts. Look at the Left, Mid,Right and Len functions in the Help file to
    separately get EX0001 and 123456.


    --
    PC Datasheet
    Your Resource For Help With Access, Excel And Word Applications
    resource@pcdata sheet.com



    "Dave" <david.roebuck@ btinternet.com> wrote in message
    news:c15kgt$hfb $1@sparta.btint ernet.com...[color=blue]
    > I have a folder which contains *.doc files. What I want to do is strip
    > out the name of the doc and put the first part in a column in a table and
    > the second part in another column of the table then move the doc to another
    > file. Once I have done this I want to go through all the other files doing
    > the same.
    > My file name is something like "EX0001-123456"
    > EX0001 will go in column 1 of tblfiles and 123456 will go in column 2 of the
    > table.
    >
    > Can any one help me in the vba required to do this?
    >
    > Thanks in advance
    > Dave
    >
    >[/color]


    Comment

    • Dave

      #3
      Re: Strip document name

      Thanks for your reply, but having done this how do I move on to the next
      file?

      Dave
      "PC Datasheet" <spam@nospam.sp am> wrote in message
      news:KFsZb.1317 1$hm4.2991@news read3.news.atl. earthlink.net.. .[color=blue]
      > Look at the Dir function in the Help file to retrieve file names from a[/color]
      folder.[color=blue]
      > Look at the Instr function in the Help file to break the file name into[/color]
      two[color=blue]
      > parts. Look at the Left, Mid,Right and Len functions in the Help file to
      > separately get EX0001 and 123456.
      >
      >
      > --
      > PC Datasheet
      > Your Resource For Help With Access, Excel And Word Applications
      > resource@pcdata sheet.com
      > www.pcdatasheet.com
      >
      >
      > "Dave" <david.roebuck@ btinternet.com> wrote in message
      > news:c15kgt$hfb $1@sparta.btint ernet.com...[color=green]
      > > I have a folder which contains *.doc files. What I want to do is[/color][/color]
      strip[color=blue][color=green]
      > > out the name of the doc and put the first part in a column in a table[/color][/color]
      and[color=blue][color=green]
      > > the second part in another column of the table then move the doc to[/color][/color]
      another[color=blue][color=green]
      > > file. Once I have done this I want to go through all the other files[/color][/color]
      doing[color=blue][color=green]
      > > the same.
      > > My file name is something like "EX0001-123456"
      > > EX0001 will go in column 1 of tblfiles and 123456 will go in column 2 of[/color][/color]
      the[color=blue][color=green]
      > > table.
      > >
      > > Can any one help me in the vba required to do this?
      > >
      > > Thanks in advance
      > > Dave
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Bas Cost Budde

        #4
        Re: Strip document name

        Dave wrote:
        [color=blue]
        > Thanks for your reply, but having done this how do I move on to the next
        > file?[/color]

        Call Dir() again with no arguments. As long as that doesn't return ''
        you have the next file.

        --
        Bas Cost Budde

        but the domain is nl

        Comment

        Working...