Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Incomplete SaveAs name

[Xl97] This piece of code is to copy 2 sheets ('Data' and 'Selection')
to a new workbook and name and save the new book to a path and with a
name from the 'Selection' sheet of the new workbook. The path is in
'Selection' G2 and the name in B2. It produces the copy workbook, saves
it using the correct path but only uses the date as the file name, and
does not include the identifier in B2.
G2 reads E:\ELS\Inspections\
B2 reads ELSpilot

Sheets(Array("Data", "Selection")).Select
Sheets(Array("Data", "Selection")).Copy

ActiveWorkbook.SaveAs FileName:= _
Sheets("Selection").Range("G2") & Range("B2") & _
Format(Now(), " DD.MM.YY") & ".xls"

--
Robert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Incomplete SaveAs name

Robert,

Range B2 refers to the active sheet, which may not be sheet "Selection".

Try
fileName = Sheets("Selection").Range("G2") & Sheets("Selection").Range("B2")
& _
Format(Now(), " DD.MM.YY") & ".xls"

HTH
Anders Silvén

"Robert" skrev i meddelandet
...
[Xl97] This piece of code is to copy 2 sheets ('Data' and 'Selection')
to a new workbook and name and save the new book to a path and with a
name from the 'Selection' sheet of the new workbook. The path is in
'Selection' G2 and the name in B2. It produces the copy workbook, saves
it using the correct path but only uses the date as the file name, and
does not include the identifier in B2.
G2 reads E:\ELS\Inspections\
B2 reads ELSpilot

Sheets(Array("Data", "Selection")).Select
Sheets(Array("Data", "Selection")).Copy

ActiveWorkbook.SaveAs FileName:= _
Sheets("Selection").Range("G2") & Range("B2") & _
Format(Now(), " DD.MM.YY") & ".xls"

--
Robert



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Incomplete SaveAs name

Robert,

Try

Private Sub Mysub()
With Sheets("Selection")
ActiveWorkbook.SaveAs Filename:= _
.Range("G2").Value & .Range("B2").Value & _
" " & Format(Date, "DD.MM.YY") & ".xls"
End With

End Sub






"Robert" wrote in message
...
[Xl97] This piece of code is to copy 2 sheets ('Data' and 'Selection')
to a new workbook and name and save the new book to a path and with a
name from the 'Selection' sheet of the new workbook. The path is in
'Selection' G2 and the name in B2. It produces the copy workbook, saves
it using the correct path but only uses the date as the file name, and
does not include the identifier in B2.
G2 reads E:\ELS\Inspections\
B2 reads ELSpilot

Sheets(Array("Data", "Selection")).Select
Sheets(Array("Data", "Selection")).Copy

ActiveWorkbook.SaveAs FileName:= _
Sheets("Selection").Range("G2") & Range("B2") & _
Format(Now(), " DD.MM.YY") & ".xls"

--
Robert



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Incomplete SaveAs name

Henry - many thanks it solved the problem

Robert

n message , Henry
writes
Robert,

Try

Private Sub Mysub()
With Sheets("Selection")
ActiveWorkbook.SaveAs Filename:= _
.Range("G2").Value & .Range("B2").Value & _
" " & Format(Date, "DD.MM.YY") & ".xls"
End With

End Sub


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
Formula incomplete Wanna Learn Excel Discussion (Misc queries) 2 September 25th 08 01:01 PM
incomplete name on y axis jdhcrbc Excel Discussion (Misc queries) 0 August 10th 08 11:32 PM
Incomplete scroll bar bubbaslb Excel Discussion (Misc queries) 0 November 30th 07 08:55 PM
Sorting is Incomplete Patlee Excel Discussion (Misc queries) 13 May 26th 07 07:30 PM
oldest incomplete job floridasurfn Excel Worksheet Functions 3 July 11th 06 05:42 PM


All times are GMT +1. The time now is 02:35 AM.

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

About Us

"It's about Microsoft Excel"