ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Save As "cell Value" (https://www.excelbanter.com/excel-discussion-misc-queries/105820-save-cell-value.html)

bpreas

Save As "cell Value"
 

I need to record a macro that will save a file (file name) as the value
in a specific cell. Can this be done?


--
bpreas
------------------------------------------------------------------------
bpreas's Profile: http://www.excelforum.com/member.php...o&userid=34705
View this thread: http://www.excelforum.com/showthread...hreadid=573170


Dave F

Save As "cell Value"
 
I get this code when I record a macro which does what you're describing:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 8/18/2006 by David Nevin Friedman
'

'
Application.Run Range("AUTOSAVE.XLA!mcs02.OnTime")
Range("E10").Select
ActiveCell.FormulaR1C1 = "save this file as the value in this cell"
ChDir "C:\Documents and Settings\df78700\Desktop"
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\df78700\Desktop\save this file as the
value in this cell.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub
--
Brevity is the soul of wit.


"bpreas" wrote:


I need to record a macro that will save a file (file name) as the value
in a specific cell. Can this be done?


--
bpreas
------------------------------------------------------------------------
bpreas's Profile: http://www.excelforum.com/member.php...o&userid=34705
View this thread: http://www.excelforum.com/showthread...hreadid=573170



Die_Another_Day

Save As "cell Value"
 
Dave's solution is a hard coded value. Use this modification:

ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\df78700\Desktop\" _
& Sheets("YourSheet").Range("A1")
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

Charles

Dave F wrote:
I get this code when I record a macro which does what you're describing:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 8/18/2006 by David Nevin Friedman
'

'
Application.Run Range("AUTOSAVE.XLA!mcs02.OnTime")
Range("E10").Select
ActiveCell.FormulaR1C1 = "save this file as the value in this cell"
ChDir "C:\Documents and Settings\df78700\Desktop"
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\df78700\Desktop\save this file as the
value in this cell.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub
--
Brevity is the soul of wit.


"bpreas" wrote:


I need to record a macro that will save a file (file name) as the value
in a specific cell. Can this be done?


--
bpreas
------------------------------------------------------------------------
bpreas's Profile: http://www.excelforum.com/member.php...o&userid=34705
View this thread: http://www.excelforum.com/showthread...hreadid=573170




bpreas

Save As "cell Value"
 

This solution works perfectly!


--
bpreas
------------------------------------------------------------------------
bpreas's Profile: http://www.excelforum.com/member.php...o&userid=34705
View this thread: http://www.excelforum.com/showthread...hreadid=573170



All times are GMT +1. The time now is 12:30 AM.

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