save as file name to a designated folder & email as an attachment using a specific outlook template

Trevor3007

Well-known Member
Joined
Jan 26, 2017
Messages
675
Office Version
  1. 365
Platform
  1. Windows
good day ,

I have the following code :-

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    Set Target = Range("a10")
    If Target = "" Then Exit Sub
    On Error GoTo Badname
    
ActiveSheet.Name = "testdeta WC" & Format(Range("a10").Value, "dd-mm-yyyy")
    
    Exit Sub
Badname:
    MsgBox "Please revise the entry in a10." & Chr(13) _
    & "It appears to contain one or more " & Chr(13) _
    & "illegal characters." & Chr(13)
    Range("a10").Activate
    ActiveWorkbook.SaveAs Filename:="C:\Users\user\Desktop\testdata" & Application.PathSeparator & ActiveWorkbook.Sheets(1).Name
End Sub
Sub Invoice()


Dim Path1 As String
Dim Path2 As String
Dim Path3 As String
Dim Path4 As String
Dim myfilename As String




Path = "C:\Users\user\Desktop\testdata"
Path1 = Range("a1")
Path2 = Range("b1")
Path3 = Range("f1")
Path4 = Range("g1")


ActiveWorkbook.SaveAs Filename:=Path & Path1 & Path2 & Path3 & Path4 & ".xls", FileFormat:=xlNormal




End Sub



the issue ATM , that it will not save to the specific folder, but I can 'manually' save it to.

would it be possible to include a Yes/No / Both so it saves the file as either 'xls' ( to "C:\Users\user\Desktop\testdata"") and as a xlsm ("C:\Users\user\Desktop\testdata\macro") or both to there retrospective folders?

include a Yes / No message asking 'do you want to attach and email the saved file using the your designated outlook template? ( located in "C:\Users\user\Desktop\testdata\mailtemplate')

many thank in advance to the very kind person(s) who takes up this challenge
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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
Back
Top