vba excel save as with are you sure but......... There's a catch

cizzett

Board Regular
Joined
Jan 10, 2019
Messages
121
So I want to initiate the save as for the file when the user clicks the "Finalize report" button but there's a small difficulty

I have the name for the file and the location of the file in a sheet that takes todays date and formats it to match the location of the file in the network drive and the date format that I want it saved.

File Address should be:
I:\Inventory\Quality Reports\2019\3-2019

<tbody>
</tbody>
which is in cell B25 on the file locations sheet in the workbook


File should be named 03-28-2019

as located in cell B24 on the file locations sheet in the workbook.

Im hoping it will do the save as on its own, maybe just open a MsgBox to say "Are you sure youre ready to save the file"

Any help would be greatly appreciated.
 
Last edited:

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

cizzett

Board Regular
Joined
Jan 10, 2019
Messages
121
This is what I have tried but it bugs out

Code:
Sub SaveFinal()

Dim wb As Workbook: Set wb = ThisWorkbook
  Dim fs As Worksheet: Set fs = wb.Sheets("File Locs")


ThisWorkbook.SaveAs Filename:=(fs.Range("B25").Value) & (fs.Range("B24").Value), FileFormat:=xlOpenXMLWorkbookMacroEnabled

End Sub
 
Last edited:

cizzett

Board Regular
Joined
Jan 10, 2019
Messages
121
Solved!!!!!!!!!!!!!!!!!!!!!!!!!!

So After doing a
Code:
=CONCATENATE(B22,"\",TEXT(B23,"M-YYYY"),"\",TEXT(B24,"MM-DD-YYYY"))

In the cell for the address I then have the below to save using this the combined address

Code:
Sub SaveFinal()
  
  Dim wb As Workbook: Set wb = ThisWorkbook
    Dim fs As Worksheet: Set fs = wb.Sheets("File Locs")
     Dim FP As String
      Dim FN As String
     FP = fs.Range("B25").Value
        
    MsgBox "You are trying to save the file to:" & FP
  
ThisWorkbook.SaveAs Filename:=FP, FileFormat:=xlOpenXMLWorkbookMacroEnabled


End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,123,271
Messages
5,600,651
Members
414,399
Latest member
Ninjee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top