+ Reply to Thread
Results 1 to 4 of 4

help with making a directory and saving the spreadsheet

  1. #1

    help with making a directory and saving the spreadsheet

    assume the folowing spreadsheet

    1
    A Bristol
    B r-11111
    C 1st april 2006

    I want to be able to click on a button and it to do the following:

    1. check to see if a path exists called c:\ and the contents of cell
    A1 ie c:\bristol, if not then create one.

    2. save the spreadsheet with the name cell a1 + cell a2 + the month and
    year of cell a3.xls ie Bristol r-11111 april 2006.xls and put it into
    the above directory.

    how can i do this?


  2. #2
    Tom Ogilvy
    Guest

    RE: help with making a directory and saving the spreadsheet

    Probably something like this:

    Dim s as String, s1 as String
    On error Resume next
    s = "C:\" & ActiveSheet.Range("A1").Text
    mkdir s
    s = s & "\"
    s1 = Range("A1").Text _
    & " " & Range("A2").Text _
    & " " & format(Range("A3"),"mmm yyyy") & ".xls"
    activeworkbook.SaveAs s & s1
    On Error goto 0
    if dir(s & s1) <> "" then
    msgbox s1 & " successfully saved"
    else
    msgbox "Problems "
    End if


    --
    Regards,
    Tom Ogilvy

    "[email protected]" wrote:

    > assume the folowing spreadsheet
    >
    > 1
    > A Bristol
    > B r-11111
    > C 1st april 2006
    >
    > I want to be able to click on a button and it to do the following:
    >
    > 1. check to see if a path exists called c:\ and the contents of cell
    > A1 ie c:\bristol, if not then create one.
    >
    > 2. save the spreadsheet with the name cell a1 + cell a2 + the month and
    > year of cell a3.xls ie Bristol r-11111 april 2006.xls and put it into
    > the above directory.
    >
    > how can i do this?
    >
    >


  3. #3

    Re: help with making a directory and saving the spreadsheet

    I'll give that a go. thx


  4. #4

    Re: help with making a directory and saving the spreadsheet

    worked great. Inow realise why I couldn't get my code to work -
    forgot the backslash

    thx once again


+ 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