简体   繁体   中英

open outlook mail in customized form

I have created a small application in Excel-VBA which takes inputs from a user and the application sends and email to me the inputs in an encrypted form.
Now, I have a macro in outlook-vba which takes care of decryption and saves data in required format, so that's not a problem. What I need is I want to open that specific mail from the user in a customized format so that without running that script I could see the data. Eg The data comes in like this

1~Saurav Gupta~100^2~Sachin Rana~200^

Now I want it to be shown as in a tabular format in a form, say

S.No Name       Marks 
1   Saurav Gupta  100 
2   Sachin Rana   200

Any idea how can I achieve that?

Thanks and regards Saurav.

Use the builtin Split function to separate the lines and the fields in the data:

Option Explicit

Sub SplitTest()
    Dim sInput As String
    Dim sLines() As String
    Dim sFields() As String
    Dim iLine As Integer

    sInput = "1~Saurav Gupta~100^2~Sachin Rana~200^"

    '***** Split sInput into lines
    sLines = Split(sInput, "^")

    '***** Do something with the lines
    For iLine = 0 To UBound(sLines) - 1
        Debug.Print sLines(iLine)

        '***** Split each line into fields
        sFields = Split(sLines(iLine), "~")

        '***** Do something with the fields
        Debug.Print "#1. " & sFields(0) & ", #2. " & sFields(1) & ", #3. " & sFields(2)
    Next iLine

End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM