#1   Report Post  
Member
 
Posts: 33
Default Auto Saving

Hi All,

I'v found this code to auto save my worksheet with the name in C1. I want to specify the directory to save it to. Does anyone know what code i can put in it to save to the following directory
L:\Credit Management Team\Gareth Thomas

I also want to change it to just save the 1 sheet in the workbook.

Sub SaveAsCell()
Dim strName As String

On Error GoTo InvalidName
strName = Sheet1.Range("C1")
ActiveWorkbook.SaveAs strName

Exit Sub
InvalidName: MsgBox "The text: " & strName & _
" is not a valid file name.", vbCritical, "Ozgrid.com"
End Sub

Last edited by GarToms : January 31st 06 at 12:55 PM
  #2   Report Post  
Posted to microsoft.public.excel.misc
Kevin B
 
Posts: n/a
Default Auto Saving

When you assign the value of the worksheet name to the variable string name,
concatenate the full path to the file

strName = "L:\Credit Management Team\Gareth Thomas\" & _
Worksheets("Sheet1").Range("C1").Value
--
Kevin Backmann


"GarToms" wrote:


Hi All,

I'v found this code to auto save my worksheet with the name in C1. I
want to specify the file to save it to. Does anyone know what code i
can put in it to save to the following directory
L:\Credit Management Team\Gareth Thomas


Sub SaveAsCell()
Dim strName As String

On Error GoTo InvalidName
strName = Sheet1.Range("C1")
ActiveWorkbook.SaveAs strName

Exit Sub
InvalidName: MsgBox "The text: " & strName & _
" is not a valid file name.", vbCritical, "Ozgrid.com"
End Sub


--
GarToms

  #3   Report Post  
Member
 
Posts: 33
Default

excelent cheers

Quote:
Originally Posted by Kevin B
When you assign the value of the worksheet name to the variable string name,
concatenate the full path to the file

strName = "L:\Credit Management Team\Gareth Thomas\" & _
Worksheets("Sheet1").Range("C1").Value
--
Kevin Backmann


"GarToms" wrote:


Hi All,

I'v found this code to auto save my worksheet with the name in C1. I
want to specify the file to save it to. Does anyone know what code i
can put in it to save to the following directory
L:\Credit Management Team\Gareth Thomas


Sub SaveAsCell()
Dim strName As String

On Error GoTo InvalidName
strName = Sheet1.Range("C1")
ActiveWorkbook.SaveAs strName

Exit Sub
InvalidName: MsgBox "The text: " & strName & _
" is not a valid file name.", vbCritical, "Ozgrid.com"
End Sub


--
GarToms
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
Running auto correct on startup? Mitch Excel Discussion (Misc queries) 1 November 28th 05 06:38 PM
Averaging Values in Auto Filter Mr. Jan Park Excel Worksheet Functions 1 August 3rd 05 03:51 PM
Auto Update Linking and Saving Chewy Excel Discussion (Misc queries) 3 May 13th 05 08:41 PM
excel links update not working in auto, calculations in auto Mikey Boy Excel Worksheet Functions 0 December 7th 04 11:53 PM
Why can't my macro use Auto Filter when I told the Sheet Protecti. KC Rippstein Excel Worksheet Functions 1 October 28th 04 06:13 PM


All times are GMT +1. The time now is 08:22 AM.

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"