Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 159
Default Naming files

How would I go about saving a file as the concatenation of B1,C1, and E1 in a
macro
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Naming files

with activeworkbook.worksheets("sheet9999")
.parent.saveas filename:="C:\temp\" & _
.range("B1").value & .range("C1").value & .range("E1").value & ".xls" _
fileformat:=xlworkbooknormal
end with

(untested, watch for typos)

Larry wrote:

How would I go about saving a file as the concatenation of B1,C1, and E1 in a
macro


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Naming files

filename = range(B1).value & range(C1).value & range(E1).value

I'm assuming that the active sheet is the same sheet where these ranges are
stored.

You need to have your save code looking something like this:

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Customer\Desktop\Book1.xls",
FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False


"Larry" wrote:

How would I go about saving a file as the concatenation of B1,C1, and E1 in a
macro

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 159
Default Naming files

Is there a way to use the default path that excell is using? if someone else
used this the macro would have to be changed to work for them

"Larry" wrote:

How would I go about saving a file as the concatenation of B1,C1, and E1 in a
macro

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Naming files

Larry,

CurDir will return the current default path.
ThisWorkbook.Path will return the path of the workbook containing the code.
ActiveWorkbook.Path will return the path of the workbook that is currently
active, which may or may not be the workbook containing the code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting LLC
www.cpearson.com
(email on the web site)


"Larry" wrote in message
...
Is there a way to use the default path that excell is using? if someone
else
used this the macro would have to be changed to work for them

"Larry" wrote:

How would I go about saving a file as the concatenation of B1,C1, and E1
in a
macro





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 159
Default Naming files

This is the code I came up with. It seems to work so I guess that is all I
need. I don't think I need to password it.

With ActiveWorkbook.Worksheets("sheet1")
.Parent.SaveAs Filename:=.Range("B1").Value & .Range("C1"). _
Value & .Range ("E1").Value & ".xls"
End With

Thanks everyone


"Larry" wrote:

How would I go about saving a file as the concatenation of B1,C1, and E1 in a
macro

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
Tab Naming Johnny Excel Discussion (Misc queries) 2 August 29th 06 03:29 PM
Creating and Naming a Folder and populating it with files Myles[_78_] Excel Programming 2 August 20th 06 12:29 PM
Creating and Naming a Folder and populating it with files Myles[_79_] Excel Programming 1 August 20th 06 12:29 PM
intersection naming transport between files BorisS Excel Discussion (Misc queries) 0 June 29th 06 08:37 PM
VBA - Looping thro same naming files in 2 directories........PLEASE HELP Manju[_3_] Excel Programming 0 March 10th 06 03:26 PM


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