Forum

Cell Value as file ...
 
Notifications
Clear all

Cell Value as file name

8 Posts
2 Users
0 Reactions
475 Views
(@josros60)
Posts: 47
Trusted Member
Topic starter
 

Hi,

False Then MsgBox "Save as " & save_name End If End Sub> 

have the code below how can I modify it that can use the value in cell A105 as the file name.

 

Code:

Sub Save_Workbook_NewName()

Dim fd As FileDialog

Set fd = Application.FileDialog(msoFileDialogFilePicker)
' Change initial folder as needed or store it in a cell and reference that
fd.InitialFileName = "\mtlnas01EFT_backup2021"
'fd.AllowMultiSelect = True
FilePicked = fd.Show

 ActiveSheet.Shapes("Button 13").Delete
 ActiveSheet.Shapes("Button 15").Delete
  ActiveSheet.Shapes("Button 17").Delete
  ActiveSheet.Shapes("Button 19").Delete
 ActiveSheet.Shapes("CommandButton1").Delete
 Worksheets("USD_WIRES").Range("A1").ClearComments
 Worksheets("USD_WIRES").Range("J1").ClearComments
 Worksheets("USD_WIRES").Range("K1").ClearComments
 
 
 save_name = Application.GetSaveAsFilename(fileFilter:="Excel File (*.xlsx), *.xlsx")
    ActiveWorkbook.SaveAs Filename:=save_name, FileFormat:=51
  [COLOR=rgb(184, 49, 47)]ThisWorkbook.SaveAs Range("A1"), 51    [/B][/COLOR]
    If save_name <> False Then
        MsgBox "Save as " & save_name
    End If


 End Sub

Thank you,
 
 
Posted : 05/11/2021 10:56 am
(@catalinb)
Posts: 1937
Member Admin
 

Try:

save_name=Activesheet.Range("A105").Value

Make sure cell A105 has the extension as well, not just the complete file path, if not, add it:

save_name=Activesheet.Range("A105").Value & ".xlsx"

 
Posted : 07/11/2021 12:52 am
(@josros60)
Posts: 47
Trusted Member
Topic starter
 

Thank you, Catalin.

 

I'll test it and let you know.

 
Posted : 07/11/2021 5:47 pm
(@josros60)
Posts: 47
Trusted Member
Topic starter
 

Hi Catalin,

Question

 

I used your suggestions to save the file

 

save_name=Activesheet.Range("A105").Value but can't figure out how to put in cell a105 to put the complete file path in the formula.

 

Any suggestion.

 

Thank you

 
Posted : 20/11/2021 12:29 am
(@catalinb)
Posts: 1937
Member Admin
 

how to put in cell a105 to put the complete file path in the formula.

What formula you have in A105?

And where is the folder location?

 
Posted : 20/11/2021 1:26 am
(@josros60)
Posts: 47
Trusted Member
Topic starter
 

Hi,

 

is the information:

 

Formula placed on cell "A88":  =" "&O1&" "&A78&" NCL USD Wires Summary "&TEXT(A2,"MMMM DD, YYYY")&""

Formula results: 330 4 NCL USD Wires Summary November 18, 2021

Location: "\mtlnas01EFT_backup2021"

 

thank you,

 
Posted : 20/11/2021 12:09 pm
(@catalinb)
Posts: 1937
Member Admin
 

I don't understand the problem, looks like you know how to join pieces of text together.

Why not adding the location to your formula:

="\mtlnas01EFT_backup2021"&O1&" "&A78&" NCL USD Wires Summary "&TEXT(A2,"MMMM DD, YYYY")&".xlsx"

 
Posted : 20/11/2021 4:26 pm
(@josros60)
Posts: 47
Trusted Member
Topic starter
 

thank you.

 
Posted : 20/11/2021 5:09 pm
Share: