LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Trying to save contents of cell as the file name

There's something very wrong if you can't do:
ActiveWorkbook.SaveAs Filename:=Range("B7").Value & ".xls"

This works fine on my computer.

Does the same crashing happen with a fresh workbook?


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Brianne " wrote in message
...
Hope someone can help me with this. My attempts have been
less then perfect to say the very least.

To summarize, I have a worksheet which I would like to save
based on the contents residing in a particular cell.

I have tried every method I could find based on my searches
here and on other sites.

Here are the examples of what I have tried so far:

ActiveWorkbook.SaveAs Filename:=Range("B7").Value & ".xls"

= = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = =

Sub SaveFileAsCell()
Dim strFileName As String
strFileName = Range("B7").Value & ".xls"
ActiveWorkbook.SaveAs strFileName
End Sub

= = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = =

Sub SaveFileAsCell()
Dim strFileName As String
strFileName = Range("B7").Value & ".xls"
ActiveWorkbook.SaveAs Filename:=strFileName
End Sub

= = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = =

ActiveWorkbook.SaveAs Filename:=Sheets("Sheet1").Range("B7").Value &
".xls"

= = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = =

ActiveWorkbook.SaveAs Filename:= Activesheet.Range("B7")

= = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = =

ActiveWorkbook.SaveAs Range("B7").Value & ".xls"

= = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = =

ActiveWorkbook.SaveAs ActiveWorkbook.Sheets("Sheet1").Range("B7") &
".xls"

= = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = = = = = = =

None of the the examples I listed above have worked at all. In
fact, not only do they not work, but all of them have crashed Excel.

My worksheet works fine up to the point where I try to include
any of the code I just listed. I wouldn't think it's a question of
a problem with the file name either. I'm not using an illegal
characters as part of the file name and the name is only 6
characters long.

Anyone have any ideas of something I could try which actually
works?

Thank you,

Brianne


---
Message posted from http://www.ExcelForum.com/



 
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
2007 Macro to Open File, Delete Contents, Save New File Flintstone[_2_] Excel Discussion (Misc queries) 2 February 1st 10 11:25 PM
Error when already same name / Macro save as cell contents NeedToKnow Excel Discussion (Misc queries) 2 June 19th 08 04:40 AM
How to save file in a macro taking new name from cell contents? LowIQ Excel Discussion (Misc queries) 3 May 31st 06 10:52 PM
How to set SAVE AS file name to equal A1 contents when rename file E Excel Discussion (Misc queries) 0 October 19th 05 08:36 PM
using a macro to define the contents of a cell as the save as name SeanMagoo Excel Programming 1 September 3rd 03 10:59 PM


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

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"