Results 1 to 6 of 6
  1. #1
    tgavin is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Location
    New York
    Posts
    22

    Changing color in middle of email message

    A client is "going green" and wants additional text in the email that sends the PO to vendors to be in green text...How??
    DoCmd.SendObject acSendReport, "rptPO", acFormatPDF, [txtEmail], , , "Propper PO#" & [txtPO], "Attached is the PO requested. Please ship by " & [txtFreight] & " as stated on the Purchase Order." & Chr(13) & Chr(10) & Chr(10) & At this point I need to turn the font color green "In our effort to make saving the environment a primary focus for all, Propper Mfg Co is going green." & Chr(13) & Chr(10) & Chr(10) & "A pdf file for all invoices & Certificates of Conformance (when required) will add to a better world for us and our children. " & _....
    I also need to turn it black again for the last line.


    Any help would be appreciated.
    Thanks

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    make a variable that holds the string to be green. change it's color green. break the larger string and insert + concatenate the variable into the bigger string. So it would go from:
    "I want the word green to come out green"
    to:
    "I want the word " & txtGreen & " to come out green"

  3. #3
    tgavin is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    New York
    Posts
    22

    Changing the color

    That helped a lot but I don't know how to turn it green...This is what I tried...

    Dim stDocName As String
    Dim lngGreen As Long
    Dim stInsert As String

    stDocName = "rptPO"
    stInsert = "In our effort... & Chr(13) & Chr(10) & Chr(10) & "Thank you. "
    lngGreen = RGB(0, 255, 0)

    stInsert.ForeColor = lngGreen

    DoCmd.SendObject acSendReport, "rptPO", acFormatPDF, [txtEmail], , "lmaya@proppermfg.com; iyepes@proppermfg.com", "Propper PO#" & [txtPO], "Attached is the PO requested. Please ship by " & [txtFreight] & " as stated on the Purchase Order." & Chr(13) & Chr(10) & Chr(10) & "If " & _
    "you cannot open the attachment or there are any problems with this order, please contact " & [txtPOBy] & " at" & _
    "purchasing@proppermfg.com. Thank you." & Chr(13) & Chr(10) & Chr(10) & stInsert & Chr(13) & Chr(10) & Chr(10) & "Pls advise if you are unable to e-mail.", True

    If I take out the stInsert.ForeColor = lngGreen, it works except for turning green. Obviously, I have never had to use code to format before so your help would be greatly appreciated.

  4. #4
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    .ForeColor = vbGreen

    I should add. I've never done this. Just an idea off the top of my head. It's the same way I change the color of my labels. I assume it'll work for a string variable.

  5. #5
    tgavin is offline Novice
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    New York
    Posts
    22
    Me!stInsert.ForeColor = vbGreen returns the message Purchasing can't find the field stInsert

  6. #6
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    why do you have Me!? it's just a variable. Further, I dont think variables like that even have the .forecolor attribute. if it does it should just be
    stInsert.ForeColor = vbGreen

    EDIT: yea, did a bit of research. I dont think you can directly change the color of the string in a variable. you would have to change the color of the control that will be displaying the string. I think what you would wind up having to do is build the outlook email directly in VBA and alter the text in the body of the email. Sorry I'm not more help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 11-12-2010, 10:55 AM
  2. Changing font color based on criteria
    By Pattie Weaver in forum Reports
    Replies: 5
    Last Post: 11-02-2010, 03:38 PM
  3. how select middle characters on string ???
    By ayman.maher in forum Queries
    Replies: 1
    Last Post: 04-27-2010, 09:29 AM
  4. Extract text from middle of a field
    By AccessNubie in forum Access
    Replies: 3
    Last Post: 11-02-2009, 01:13 PM
  5. Replies: 1
    Last Post: 03-09-2006, 01:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums