calling a module error

rjmdc

Well-known Member
Joined
Apr 29, 2020
Messages
672
Office Version
  1. 365
Platform
  1. Windows
i try to call fraud check then it hits the call email and fails saying expected variable or procedure not module
what am i doing wrong?
Code:
 [/COLOR][COLOR=rgb(0, 0, 0)]Call EmailTotalFraud[/COLOR][COLOR=rgb(184, 49, 47)]  thius is where it fails[/COLOR]
    
End Sub

then email code is
Rich (BB code):
Sub EmailTotalFraud()
  Dim sMail As String, sSubj As String, sBody As String
  Dim TotalFraud        As String:      TotalFraud = Worksheets("Fraud Check").Range("TotalFraudulent")
  Dim TotalAgencyFraud  As String:      TotalAgencyFraud = Worksheets("Fraud Check").Range("AgencyFraudulent")
  Dim FileName          As String:      FileName = "Individual and Agency Fraud Check " & Replace(ReportDate, "/", ".")
  Dim FullFilePath      As String
  Dim ReportDate        As String:      ReportDate = Date
  Dim SaveFolder1       As String:      SaveFolder1 = "M:\all\Fraud Check Complete\"
  
  FullFilePath = ExportFolder & PeriodRunFolder

        sMail = "xxxx@gmail.org"
        sSubj = " Fraud Check"
        sBody = "Fraud check was processed and reviewed on " & Date & "  Total Individual Fraud found " & TotalFraudulent & "  Total Agency Fraud found " & AgencyFraudulent & "." & vbCrLf & _
                 FileName & "can be found in " & SaveFolder1
        Call SendMailTotal(sMail, sSubj, sBody)
      
End Sub

Sub SendMailTotal(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
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Probably the same issue as your other thread. You are using the range names in sBody and not your variables
 
Upvote 0
that cant be because it fails at call the email there are no variables there
fail says expected variable or procedure not module
 
Upvote 0
Make sure that you do not have a module with the same name as a sub.
 
Upvote 0
thanks that was the error. i had difefrent capital letters and lowercase but it was seen as the smae name
i appreceiate your moderating
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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