hi
i have an export file module
i am trying to add a call email as part of the export
i am doing something incorrectly
then this is my email module:
potentailly i would like to call email1 and then create also an email2
this is not working
i have an export file module
i am trying to add a call email as part of the export
i am doing something incorrectly
Rich (BB code):
Sub ExportStBill()
Call WSUnProtect(Worksheets("State Billing"))
Dim wb As New Workbook
Dim SaveFolder As String: SaveFolder = "my folder\"
Dim FileName As String
With Worksheets("State Billing")
FileName = .Cells(2, "B") & " " & Format(.Cells(1, "B"), "m-yyyy")
Set tbl = .ListObjects(1)
tbl.Range.Copy
End With
Set wb = Workbooks.Add
wb.Activate
wb.Sheets(1).Range("A1").PasteSpecial xlPasteAll
Selection.Columns.AutoFit
'Save and Close New WB
wb.SaveAs SaveFolder & "\" & FileName, xlOpenXMLWorkbook
wb.Close SaveChanges:=False
'Back to Main WB
ThisWorkbook.Activate
Call WSProtect(Worksheets("State Billing"))
'Inform User
MsgBox "File Export Complete", vbOKCancel
' If Result = vbOK Then
'
' Call email1
' End If
End Sub
then this is my email module:
Rich (BB code):
Sub email1()
Dim sMail As String, sSubj As String, sBody As String
sMail = "mail@mail.org"
sSubj = "Billing ready for submission"
sBody = "Billing is ready for submission in myfolder"
Call SendMail(sMail, sSubj, sBody)
End Sub
Sub SendMail(sMail, sSubj, sBody)
Dim OutlookApp As Object
Set OutlookApp = CreateObject("Outlook.Application").CreateItem(0)
With OutlookApp
.To = sMail
.Subject = sSubj
.Body = sBody
.Display 'Display Email
.Send 'Send Email
End With
End Sub
potentailly i would like to call email1 and then create also an email2
this is not working