formatting text for Email

formatting text for Email

Ktomberlin
Advocate Advocate
970 Views
5 Replies
Message 1 of 6

formatting text for Email

Ktomberlin
Advocate
Advocate

I'm trying to automate an email we have to send upon job completion, I've started with the Curtis's illogic from . I also found info HERE. I'm almost there, but I can't seem to find the correct format to edit the text size/Font/Bolding required.  The email should look like:

 

CRITICAL ACTION: Replace old revisions on the shop floor & at vendor with the new revisions and destroy the old revisions.

 

WORK ORDER #: XXXXX/X Customer / Description

 

DESCRIPTION OF CHANGES:

 

 

This e-mail is to inform you that the drawing(s) listed below are approved:

Drawing/Part Number

Rev

Description

Status

    

 

 

 

HIGH

 

 

 

 

 

Status / Required Action:

LOW / No active quote(s) or current need. (To: )

 

MED / Need to quote or generate purchase order. (To: )

 

HIGH / There is a work order in Progress.  Destroy all copies of obsolete drawings and replace with latest revision. (To: )

 

SALES / This is a sales drawing. (To: )

 

All drawing files referenced in this e-mail have been loaded onto network folder: \\Server\engineering\COMMON\Parts Folder RELEASED PDFs

 

Current Ilogic:

modelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
Dim oOApp 
Dim oOMail
oOApp = CreateObject("Outlook.Application")
oOMail = oOApp.CreateItem(olMailItem)
Dim oWorkOrder As String
Dim oCustomer As String
Dim MyDesc As String
Dim MyNum As String
Dim MyDwgNum As String
Dim FontSize As Textsize
oWorkOrder  = InputBox("Enter WorkOrderNumber.",  "Work Order #!",  oWorkOrder)
oCustomer  = InputBox("Enter Customer.",  "Customer",  oCustomer)
MyDesc = iProperties.Value(modelName, "Summary", "Title")
MyNum = iProperties.Value(modelName, "Project", "Part Number")
MyDwgRev = iProperties.Value("Project", "Revision Number")
'
'Debug Msg
'MessageBox.Show(oWorkOrder & oCustomer & MyDesc & MyNum & MyDwgRev)
With oOMail
'.To = "USer@domain.com"
.Subject = "<DRAWING APPROVAL NOTIFICATION> <STATUS: HIGH> <W/O# " & oWorkOrder & oCustomer & " / " &MyDesc & "> <DRAWING NUMBER: " & MyNum & "> <REVISION:"& MyDwgRev  & " >"
.Body.FontSize = 16
.Body = "CRITICAL ACTION: BEN/BONA replace old revisions on the shop floor & at vendor with the new revisions and"
.Body = .Body & "destroy the old revisions."
.Body = .Body & "                                                                               "
.Body = .Body & "WORK ORDER #: "& oWorkOrder  & " / " & oCustomer  & " / " & MyDesc
.Body = .Body & "                                                                                "
.Body = .Body & "DESCRIPTION OF CHANGES: "
.Body = .Body & "                                                                               "
.Body = .Body & "This e-mail is to inform you that the drawing(s) listed below are approved:"
.Body = .Body & "Drawing/Part Number	  Rev	     Description	                                                  Status"
.Body = .Body & "                                                                               "
.Body = .Body & MyNum & "    " & MyDwgRev & "              " & MyDesc & "   HIGH"
.Display
'.Send
End With

 I'm trying to get there by declaring Fontsize, then .Body.Fontsize = 16, but that isn't working.  Anyone have a link to a page that would give me the correct format to change font size for this?  I'd also like to get the table lines arond the drawing/Part Number, but that isn't critical.

 

Thanks for looking.

0 Likes
Accepted solutions (2)
971 Views
5 Replies
Replies (5)
Message 2 of 6

jdkriek
Advisor
Advisor
Accepted solution

You'll need to format as HTML then use .HTMLBody with the appropriate HTML

 

.BodyFormat = olFormatHTML
.HTMLBody = "<Font Size='20'>Test this</Font>"
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


0 Likes
Message 3 of 6

Ktomberlin
Advocate
Advocate

When i add that i get the error "Value does not fall within the expected range." even after commenting out my  .body lines. But if i didn't put in the

'.BodyFormat = olFormatHTML

It didn't post the error and made the email with your enlarged Test text.

 

 

 

 

0 Likes
Message 4 of 6

jdkriek
Advisor
Advisor

Ah differences between VBA and VB.NET and then iLogic (stripped-down VB.NET).

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


0 Likes
Message 5 of 6

Ktomberlin
Advocate
Advocate
Accepted solution

Got everything working including the tabled information.  Thank you for the assistance.

 

.HTMLBody= .HTMLBody&"<TD ALIGN=CENTER>Drawing/Part Number</TD>" 
    .HTMLBody= .HTMLBody&"<TD ALIGN=CENTER>Rev</TD>" 
    .HTMLBody= .HTMLBody&"<TD ALIGN=CENTER>Description</TD>" 
    .HTMLBody= .HTMLBody&"<TD ALIGN=CENTER>Status</TD>" 
    .HTMLBody= .HTMLBody&"</TR><TR>" 
    .HTMLBody= .HTMLBody&"<TD ALIGN=CENTER>"&MyNum&"</TD>" 
    .HTMLBody= .HTMLBody&"<TD ALIGN=CENTER>"&MyDwgRev&"</TD>" 
    .HTMLBody= .HTMLBody&"<TD ALIGN=CENTER>"&MyDesc&"</TD>" 
        .HTMLBody= .HTMLBody&"<TD ALIGN=CENTER><span style='color:red'>HIGH</TD>" 
    .HTMLBody= .HTMLBody&"</TR></TABLE>"

0 Likes
Message 6 of 6

jdkriek
Advisor
Advisor

Glad I could help 😉

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


0 Likes