Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Save As in a Macro

Do you mean

ActiveWorkbook.Path & "\" & Replace(Activeworkbook.name,".xls","wb1.xls")

If this post helps click Yes
---------------
Jacob Skaria


"Derek Johansen" wrote:

I have a spreadsheet with a lot of information. I then separate them into
separate workbooks to make it easier to manage. I generally create three new
workbooks from the data. what I would like to do is Save As each of these
new work books IN THE SAME DIRECTORY as the original and with the file name
ORIGINALNAME_wb1, ORIGINALNAME_wb2 etc.

The important part is that the files are in the same directory, and contain
the original name in them... does anyone have a bit of code i could use to do
this? I've played around with the save as, but I can't figure out how to get
the same directory as the original and add on to the name... any help would
be much appreciated!

Thanks,

Derek

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Save As in a Macro

I'm not sure if this works, I get a syntax error at the first & symbol and
I'm not sure what is wrong with it.

"Jacob Skaria" wrote:

Do you mean

ActiveWorkbook.Path & "\" & Replace(Activeworkbook.name,".xls","wb1.xls")

If this post helps click Yes
---------------
Jacob Skaria


"Derek Johansen" wrote:

I have a spreadsheet with a lot of information. I then separate them into
separate workbooks to make it easier to manage. I generally create three new
workbooks from the data. what I would like to do is Save As each of these
new work books IN THE SAME DIRECTORY as the original and with the file name
ORIGINALNAME_wb1, ORIGINALNAME_wb2 etc.

The important part is that the files are in the same directory, and contain
the original name in them... does anyone have a bit of code i could use to do
this? I've played around with the save as, but I can't figure out how to get
the same directory as the original and add on to the name... any help would
be much appreciated!

Thanks,

Derek

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Save As in a Macro

Try this

Sub Macro()
strFile = Replace(ActiveWorkbook.Name, ".xls", "", 1, 1, vbTextCompare)
For intTemp = 1 To 3
ActiveWorkbook.SaveAs ActiveWorkbook.Path & "\" & _
strFile & "wb" & intTemp & ".xls"
Next
End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


"Derek Johansen" wrote:

I'm not sure if this works, I get a syntax error at the first & symbol and
I'm not sure what is wrong with it.

"Jacob Skaria" wrote:

Do you mean

ActiveWorkbook.Path & "\" & Replace(Activeworkbook.name,".xls","wb1.xls")

If this post helps click Yes
---------------
Jacob Skaria


"Derek Johansen" wrote:

I have a spreadsheet with a lot of information. I then separate them into
separate workbooks to make it easier to manage. I generally create three new
workbooks from the data. what I would like to do is Save As each of these
new work books IN THE SAME DIRECTORY as the original and with the file name
ORIGINALNAME_wb1, ORIGINALNAME_wb2 etc.

The important part is that the files are in the same directory, and contain
the original name in them... does anyone have a bit of code i could use to do
this? I've played around with the save as, but I can't figure out how to get
the same directory as the original and add on to the name... any help would
be much appreciated!

Thanks,

Derek

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
Macro to Save without the Save Message Ellen G Excel Discussion (Misc queries) 4 February 23rd 07 08:52 PM
"Save" macro problem, still prompted to save when closing workbook (?) StargateFanFromWork[_4_] Excel Programming 8 September 13th 06 04:49 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
ASP: Open Excel File with Macro, Allow Macro to run, and then save delgados129 Excel Programming 0 March 10th 05 09:35 PM
Prompted to save changes after macro save - why? Izar Arcturus Excel Programming 2 December 10th 03 09:27 PM


All times are GMT +1. The time now is 10:04 PM.

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"