-
Thanks for your help guys, this went smoother than I thought. Feel free to look over the code and offer sugestions for improvement. I am trying to become a programmer and want to learn everything I can to become one....
[VBA]
Sub GetSelectedMailText()
Dim myOlSel As Outlook.Selection
Dim strText As String
Dim intHold As Integer
Dim intCnt As Integer
Dim ValArray(5) As Integer
'check there's something selected
If Application.ActiveExplorer.Selection.Count = 1 Then
Set myOlSel = Application.ActiveExplorer.Selection
strText = myOlSel.Item(1).Body
intHold = InStr(strText, "PowerBall:") 'Get character position
intHold = intHold + 11 'Set character position for text extraction
intCnt = 0
Do Until intCnt = 6 'Load values into array
strText = Mid(strText, intHold, 2)
ValArray(intCnt) = strText
intHold = intHold + 3
intCnt = intCnt + 1
strText = myOlSel.Item(1).Body
Loop
'Create XML file for output
Open "C:\Documents and Settings\dsorensen\My Documents\Test App\TestData.xml" For Output As #1
Print #1, "<?xml version=""1.0""?>"; LnRtn
Print #1, "<numbers>"; LnRtn
intCnt = 0
For intCnt = 0 To 5
Print #1, Tab; "<n" & intCnt + 1 & ">" & ValArray(intCnt) & "</n" & intCnt + 1 & ">"
Next intCnt
Print #1, "</numbers>"
Close #1
MsgBox ("Text Extraction Is Complete")
End If
End Sub
[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules