calling a module error

rjmdc

Well-known Member
Joined
Apr 29, 2020
Messages
703
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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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,223,912
Messages
6,175,340
Members
452,638
Latest member
Oluwabukunmi

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