Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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

" 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default help with making a directory and saving the spreadsheet

I'll give that a go. thx

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving to root directory ChrisP Excel Discussion (Misc queries) 2 July 31st 06 02:10 AM
Saving into new directory Greg B Excel Discussion (Misc queries) 2 March 2nd 05 03:58 PM
Making a One Column Directory from Two Columns Dennis Hughes Excel Discussion (Misc queries) 1 January 21st 05 04:01 PM
saving/creating a directory Matt B Excel Programming 2 January 19th 04 09:35 PM
Saving to same directory Michael Beckinsale Excel Programming 1 December 12th 03 07:31 PM


All times are GMT +1. The time now is 02:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"