Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default worksheet saveas workbook

Hi,

i have tried to do this and asked the question in General questions but to
no avail. i am looking for some help on a routine to carry out the following:

save the active sheet as a separate workbook in a specific location

the specific location is in the same folder "S:\invoices" and the folder
contains sub folders Jan to Dec.

i need the worksheet to save in this location by date and sheet/ client
name. for example:
client name = range("B23")
date = ("H14")

so my worksheet i need to save is 2945, the client name is "my client" and
the date is 23rd July 2005.
my sheet would be saved as

S:\invoices\July\2945 my client
( sheet only in a book not original book saved here)

cqan anyone help me with this as i need to close this project and i cannot
seem to get it at all.

thanks in anticipation,


Nigel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default worksheet saveas workbook

Hi Nigel,

The origin of 2945 is not clear to me, but subject to that reservation, try:

'=========================
Public Sub Try()
Dim strClient As String
Dim strDate As String
Dim strPath As String
Dim sStr As String
Dim arr As Variant

arr = Array("January", "February", "March", _
"April", "May", "June", "July", _
"August", "September", "October", _
"November", "December")

strPath = "C:" '"S:\invoices"
strClient = ActiveSheet.Range("B23").Value

strDate = Month(ActiveSheet.Range("H14"))
strDate = arr(strDate - 1)

sStr = strPath & "\" & strDate & "\" & 2945 & strClient

MsgBox sStr

ActiveSheet.Copy

ActiveWorkbook.SaveAs sStr

End Sub
'=========================

---
Regards,
Norman



"Nigel" wrote in message
...
Hi,

i have tried to do this and asked the question in General questions but to
no avail. i am looking for some help on a routine to carry out the
following:

save the active sheet as a separate workbook in a specific location

the specific location is in the same folder "S:\invoices" and the folder
contains sub folders Jan to Dec.

i need the worksheet to save in this location by date and sheet/ client
name. for example:
client name = range("B23")
date = ("H14")

so my worksheet i need to save is 2945, the client name is "my client" and
the date is 23rd July 2005.
my sheet would be saved as

S:\invoices\July\2945 my client
( sheet only in a book not original book saved here)

cqan anyone help me with this as i need to close this project and i cannot
seem to get it at all.

thanks in anticipation,


Nigel



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default worksheet saveas workbook

Hi Nigel,

Correcting the base directory and simplifying, try:

'=========================
Public Sub Try()

Dim strClient As String
Dim strDate As String
Dim strPath As String
Dim sStr As String

strPath = "S:\invoices"
strClient = ActiveSheet.Range("B23").Value
strDate = Month(ActiveSheet.Range("H14"))
strDate = Format(strDate, "mmmm")
sStr = strPath & "\" & strDate & "\" & 2945 & strClient

ActiveSheet.Copy

ActiveWorkbook.SaveAs sStr

End Sub
'=========================


---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Nigel,

The origin of 2945 is not clear to me, but subject to that reservation,
try:

'=========================
Public Sub Try()
Dim strClient As String
Dim strDate As String
Dim strPath As String
Dim sStr As String
Dim arr As Variant

arr = Array("January", "February", "March", _
"April", "May", "June", "July", _
"August", "September", "October", _
"November", "December")

strPath = "C:" '"S:\invoices"
strClient = ActiveSheet.Range("B23").Value

strDate = Month(ActiveSheet.Range("H14"))
strDate = arr(strDate - 1)

sStr = strPath & "\" & strDate & "\" & 2945 & strClient

MsgBox sStr

ActiveSheet.Copy

ActiveWorkbook.SaveAs sStr

End Sub
'=========================

---
Regards,
Norman



"Nigel" wrote in message
...
Hi,

i have tried to do this and asked the question in General questions but
to
no avail. i am looking for some help on a routine to carry out the
following:

save the active sheet as a separate workbook in a specific location

the specific location is in the same folder "S:\invoices" and the folder
contains sub folders Jan to Dec.

i need the worksheet to save in this location by date and sheet/ client
name. for example:
client name = range("B23")
date = ("H14")

so my worksheet i need to save is 2945, the client name is "my client"
and
the date is 23rd July 2005.
my sheet would be saved as

S:\invoices\July\2945 my client
( sheet only in a book not original book saved here)

cqan anyone help me with this as i need to close this project and i
cannot
seem to get it at all.

thanks in anticipation,


Nigel





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
SAveAs worksheet Brian Young Excel Worksheet Functions 14 October 25th 06 12:21 PM
Using custom template with Excel.Workbook.SaveAs [email protected] Excel Programming 1 January 28th 05 04:16 AM
Canceling SaveAs dialog box without saving workbook CDotWin Excel Programming 3 July 24th 04 01:09 AM
Automatic SaveAs Worksheet Name Linc Excel Programming 3 November 13th 03 10:15 PM
Workbook.SaveAs Paul Excel Programming 2 August 25th 03 08:12 PM


All times are GMT +1. The time now is 05:50 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"