Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
NK NK is offline
external usenet poster
 
Posts: 11
Default How to save with a name in a particular cell?

I am trying to save a sheet into a new file with a name which include a text
in a cell (Cell B1 in the sheet I am going to save).

I have created the following so far, but the cell B1 comes from another
sheet where the cursor stays before the codes below. I also tried to set the
codes so that the cursor starts on the sheet, but it does not work.
I'd like to take a value in the B1 in the "Non JGB Coupon Template" sheet.
Please help.


Const fPath As String = "K:\Private\COLLATERAL\Coupon Payment Redemption\"
Dim fName As String
Dim myFileName As String

myFileName = "Non JGB Couopon" & Range("B1") & ".xls"
fName = fPath & myFileName

ThisWorkbook.Worksheets("Non JGB Coupon Template").Copy
ActiveWorkbook.SaveCopyAs Filename:=fName
ActiveSheet.Parent.Close savechanges:=False
MsgBox "File Saved to " & fName


Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How to save with a name in a particular cell?

Instead of:
Range("B1")
use:
Sheets("Non JGB Coupon Template").Range("B1")
--
Gary''s Student - gsnu200733


"nk" wrote:

I am trying to save a sheet into a new file with a name which include a text
in a cell (Cell B1 in the sheet I am going to save).

I have created the following so far, but the cell B1 comes from another
sheet where the cursor stays before the codes below. I also tried to set the
codes so that the cursor starts on the sheet, but it does not work.
I'd like to take a value in the B1 in the "Non JGB Coupon Template" sheet.
Please help.


Const fPath As String = "K:\Private\COLLATERAL\Coupon Payment Redemption\"
Dim fName As String
Dim myFileName As String

myFileName = "Non JGB Couopon" & Range("B1") & ".xls"
fName = fPath & myFileName

ThisWorkbook.Worksheets("Non JGB Coupon Template").Copy
ActiveWorkbook.SaveCopyAs Filename:=fName
ActiveSheet.Parent.Close savechanges:=False
MsgBox "File Saved to " & fName


Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
NK NK is offline
external usenet poster
 
Posts: 11
Default How to save with a name in a particular cell?

Thank you very much. It worked.

"Gary''s Student" wrote:

Instead of:
Range("B1")
use:
Sheets("Non JGB Coupon Template").Range("B1")
--
Gary''s Student - gsnu200733


"nk" wrote:

I am trying to save a sheet into a new file with a name which include a text
in a cell (Cell B1 in the sheet I am going to save).

I have created the following so far, but the cell B1 comes from another
sheet where the cursor stays before the codes below. I also tried to set the
codes so that the cursor starts on the sheet, but it does not work.
I'd like to take a value in the B1 in the "Non JGB Coupon Template" sheet.
Please help.


Const fPath As String = "K:\Private\COLLATERAL\Coupon Payment Redemption\"
Dim fName As String
Dim myFileName As String

myFileName = "Non JGB Couopon" & Range("B1") & ".xls"
fName = fPath & myFileName

ThisWorkbook.Worksheets("Non JGB Coupon Template").Copy
ActiveWorkbook.SaveCopyAs Filename:=fName
ActiveSheet.Parent.Close savechanges:=False
MsgBox "File Saved to " & fName


Thanks.

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
Disable save, save as, but allow save via command button TimN Excel Programming 10 September 1st 06 07:05 PM
How to diasble save and save as menu but allow a save button hon123456 Excel Programming 1 June 12th 06 09:50 AM
enter data in cell but cannot save until click off cell in excel T70McCains Excel Discussion (Misc queries) 1 November 18th 05 05:06 PM
Totally Disabling (^ save ) (Save as) and Save Icon – Which code do I use: harpscardiff[_10_] Excel Programming 8 November 10th 05 12:24 PM
save button in excel to save one of the worksheets with a cell value as its name Colin[_9_] Excel Programming 2 September 21st 04 11:28 PM


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