Avatar of Richard Kreidl
Richard Kreidl
Flag for United States of America

asked on 

Variable declaration without an 'As' clause; type of Object assumed.

I used the conversion wizard to convert this application to VB 2005 from VB 2003.

I'm getting an error for the function routine code.

It saying that the function name: "Mail_Out" has an error concerning
Variable declaration without an 'As' clause; type of Object assumed.

The way I'm calling the function is the following:
Mail_Out("JohnDoe@yahoo.com", "First Shift Check Sheet", Mail_FirstShift)

If I start all over and code this routine in a brand new application, I don't get the error for the function. So, it seems the automatic conversion doesn't like it.

Any ideas???
Function Mail_Out(ByVal EMailAddress As String, Optional ByVal EMailSubject As String = "", _
                  Optional ByVal EMailMessage As String = "")
        Dim application As Outlook.Application
        Dim objItem As Outlook.MailItem
        application = CreateObject("Outlook.Application")
        objItem = application.CreateItem(Outlook.OlItemType.olMailItem)
        objItem.Subject = EMailSubject
        objItem.To = EMailAddress
        objItem.HTMLBody = Mail_FirstShift
        application = Nothing
        objItem = Nothing
        Return DBNull.Value
    End Function

Open in new window

Visual Basic.NET

Avatar of undefined
Last Comment
Richard Kreidl

8/22/2022 - Mon