nardotini
New Member
- Joined
- Feb 3, 2023
- Messages
- 2
- Office Version
- 365
- 2021
- 2019
- Platform
- Windows
- MacOS
Hi,
Wanted to make a worksheet where I can save bid/invoices in a different sheet (to keep track of it) but I also wanted to save it in a specific location each time I click "Save All".
Right now I have it so that it saves in a specific location, but I want to make it so that I can put the saved files (for both PDF and Excel) in different locations.
Wanted to make a worksheet where I can save bid/invoices in a different sheet (to keep track of it) but I also wanted to save it in a specific location each time I click "Save All".
Right now I have it so that it saves in a specific location, but I want to make it so that I can put the saved files (for both PDF and Excel) in different locations.
VBA Code:
Sub SaveAll()
Dim invno As Long
Dim custname As String
Dim project As String
Dim amt As Currency
Dim dt_issue As Date
Dim term As Byte
Dim path As String
Dim fname As String
Dim nextrec As Range
invno = Range("H4")
custname = Range("B9")
project = Range("G9")
amt = Range("H36")
dt_issue = Range("H5")
term = Range("H6")
path = "C:\Users\nardo\OneDrive\Desktop\Bids\"
fname = invno & " - " & custname & " - " & project
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, IgnorePrintAreas:=False, Filename:=path & fname
Sheet3.Copy
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
shp.Delete
Next shp
With ActiveWorkbook
.Sheets(1).Name = "Bid"
.SaveAs Filename:=path & fname, FileFormat:=51
.Close
End With
Set nextrec = Sheet5.Range("A1048576").End(xlUp).Offset(1, 0)
nextrec = invno
nextrec.Offset(0, 1) = custname
nextrec.Offset(0, 2) = project
nextrec.Offset(0, 3) = amt
nextrec.Offset(0, 4) = dt_issue
nextrec.Offset(0, 5) = dt_issue + term
nextrec.Offset(0, 6) = "Not Emailed"
Sheet5.Hyperlinks.Add anchor:=nextrec.Offset(0, 8), Address:=path & fname & ".xlsx"
Sheet5.Hyperlinks.Add anchor:=nextrec.Offset(0, 7), Address:=path & fname & ".pdf"
End Sub