Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default SaveAs Concatenation

Hi All......

I have a Major Workbook that I run a macro in to open another workbook and
copy some data from the Major book into it. Then I want to SaveAs that new
workbook to the same directory that the Major Workbook came from,(without
hardcoding the path in), and with a new FileName created by Concatenating
cells B4 and B3 from a sheet in the new book named Report1.

I've tried, but just can't seem to get it right.......

Your assistance would be much appreciated.

Vaya con Dios,
Chuck, CABGx3


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default SaveAs Concatenation

Chuck,

air-coded

Set wbMajor = Workbooks("name of major workbook")
Set wbNew = Workbooks("name of new workbook)

With wbNew
.SaveAs Filename:=wbMajor.Path & "\" &
..Worksheets("Report1").Range("B4").Value & _

..Worksheets("Report1").Range("B4").Value & ".xls"
End With


--

HTH

RP
(remove nothere from the email address if mailing direct)


"CLR" wrote in message
...
Hi All......

I have a Major Workbook that I run a macro in to open another workbook and
copy some data from the Major book into it. Then I want to SaveAs that

new
workbook to the same directory that the Major Workbook came from,(without
hardcoding the path in), and with a new FileName created by Concatenating
cells B4 and B3 from a sheet in the new book named Report1.

I've tried, but just can't seem to get it right.......

Your assistance would be much appreciated.

Vaya con Dios,
Chuck, CABGx3




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default SaveAs Concatenation

For a module within your Major Workbook, this code should do it:

Dim MajorBookName as String, FolderPath as String, SaveAsName as String

MajorBookName = ThisWorkbook.FullName
FolderPath = Left(MajorBookName,InStrRev(MajorBookName,"\"))
SaveAsName = FolderPath & Workbooks("Report1").Sheets("SheetName").Range(B4) _
& Workbooks("Report1").Sheets("SheetName").Range(B3) & ".xls"
Workbooks("Report1").SaveAs SaveAsName

Hope that does it for you!

"CLR" wrote:

Hi All......

I have a Major Workbook that I run a macro in to open another workbook and
copy some data from the Major book into it. Then I want to SaveAs that new
workbook to the same directory that the Major Workbook came from,(without
hardcoding the path in), and with a new FileName created by Concatenating
cells B4 and B3 from a sheet in the new book named Report1.

I've tried, but just can't seem to get it right.......

Your assistance would be much appreciated.

Vaya con Dios,
Chuck, CABGx3


  #4   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 1,998
Default SaveAs Concatenation

Thank you kind Folks, Bob Philips and K. Dales......

You have made my day,

Vaya con Dios,
Chuck, CABGx3



"CLR" wrote:

Hi All......

I have a Major Workbook that I run a macro in to open another workbook and
copy some data from the Major book into it. Then I want to SaveAs that new
workbook to the same directory that the Major Workbook came from,(without
hardcoding the path in), and with a new FileName created by Concatenating
cells B4 and B3 from a sheet in the new book named Report1.

I've tried, but just can't seem to get it right.......

Your assistance would be much appreciated.

Vaya con Dios,
Chuck, CABGx3


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
Concatenation markmcd Excel Worksheet Functions 3 December 11th 07 12:29 AM
concatenation nandkishor Excel Worksheet Functions 2 September 5th 07 05:36 AM
Concatenation Harry Excel Worksheet Functions 2 July 17th 06 07:17 PM
concatenation mattguerilla Excel Discussion (Misc queries) 3 January 26th 06 11:47 PM
Concatenation Jim Cone Excel Programming 0 October 31st 04 01:17 AM


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