Subject not showing up in Outlook (1 Viewer)

sxschech

Registered User.
Local time
Today, 05:55
Joined
Mar 2, 2010
Messages
792
Have a button on form to send an email. All the fields (To, CC, Body text) get filled in for the outlook message except the subject. I stepped through the code and hovered over the field going into the subject and it contains data. Did I miss something or is there a typo?

Code:
With MailOutLook
        .BodyFormat = 3      'Late binding in lieu of olFormatRichText
        .To = ConcatRelated("email", "tblEmail", "distributiontype='To'", , ";") '"me@myemail.com"
        .CC = ConcatRelated("email", "tblEmail", "distributiontype='cc'", , ";")
        '.bcc = ""
        .Subject = Me.txtUCASEFilename
        .HTMLBody = stBody & "<br>" & Signature
        '.Send
        .Display  'Use for testing in lieu of .Send
End With
 

Attachments

  • Outlook_NoSubject.PNG
    Outlook_NoSubject.PNG
    11.8 KB · Views: 59

NauticalGent

Ignore List Poster Boy
Local time
Today, 08:55
Joined
Apr 27, 2015
Messages
6,322
Hello sxschech,

Out of sheer curiosity, have you tried a debug.print .Subject right after you assigned it a value? If it actually shows that it has been assigned then I have no idea what the issue is.
 

sxschech

Registered User.
Local time
Today, 05:55
Joined
Mar 2, 2010
Messages
792
Added a debug.print as suggested and showed nothing in the immediate window for subject while textbox's text shows up. Also did a len on them and that shows as 0 in immediate window for subject and 48 for textbox.

Code:
 .Subject = Me.txtUCASEFilename
        .HTMLBody = stBody & "<br>" & Signature
        '.Send
        Debug.Print "txtBox " & Me.txtUCASEFilename
        Debug.Print "len txtbox " & Len(Me.txtUCASEFilename)
        Debug.Print "Subj " & .Subject
        Debug.Print "len subj " & Len(.Subject)
 
Last edited:

NauticalGent

Ignore List Poster Boy
Local time
Today, 08:55
Joined
Apr 27, 2015
Messages
6,322
That IS strange...no idea what the issue is. Are you able to “hard code” the subject. In other words populate it with a literal? If so, then you might fare by assigning the value to a string first and then setting the subject to that string?

The only other thing I could fathom is that maybe becuase the record has not been updated/saved prior to shelling out to Outlook, the value is not getting “pushed”.
 

Frothingslosh

Premier Pale Stale Ale
Local time
Today, 08:55
Joined
Oct 17, 2012
Messages
3,276
My guess is that it was trying to assign the OBJECT txtUCASEFilename to the Subject property. Something else that may have worked is
Code:
Me.txtUCASEFilename.Value

VBA is odd like that - sometimes it thinks you're assigning the object, not the value of the default property (which is what the Value property actually is). I run into that all the time when I'm assigning values to TempVars.
 

NauticalGent

Ignore List Poster Boy
Local time
Today, 08:55
Joined
Apr 27, 2015
Messages
6,322
Figured there was a logical explanation. My first inclination always involves voodoo and midnight sacrifices...
 

Users who are viewing this thread

Top Bottom