ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trying to save contents of cell as the file name (https://www.excelbanter.com/excel-programming/293702-re-trying-save-contents-cell-file-name.html)

Brianne

Trying to save contents of cell as the file name
 
Rob, Just tried with a fresh workbook as you suggested and it
did not crash, but instead I get the following error:

Run-time error 1004:

Method 'save as' of object '_Workbook' failed

Any thoughts?

Brianne

Rob van Gelder wrote:
*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").Valu

&
".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 crashe

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 questio

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/


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


Rob van Gelder[_4_]

Trying to save contents of cell as the file name
 
What happens if you try to do the Save As action using the Excel menus? By
that I mean don't use code, do it manually? Still an error?



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


"Brianne " wrote in message
...
Rob, Just tried with a fresh workbook as you suggested and it
did not crash, but instead I get the following error:

Run-time error 1004:

Method 'save as' of object '_Workbook' failed

Any thoughts?

Brianne

Rob van Gelder wrote:
*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/
*



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




NickHK[_2_]

Trying to save contents of cell as the file name
 
Brianne,
What your actual value in the range ?

NickHk

"Brianne " wrote in message
...
Rob, Just tried with a fresh workbook as you suggested and it
did not crash, but instead I get the following error:

Run-time error 1004:

Method 'save as' of object '_Workbook' failed

Any thoughts?

Brianne

Rob van Gelder wrote:
*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/
*



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





All times are GMT +1. The time now is 09:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com