M
Mike
This piece of code worked fine when I was on Office 2000. Now I've
upgraded to 2003 I am struggling with the below if the length of
lsMailTo is longer than 1033 characters (what a strange number)
psBody = "Hello " & gsFirstName & vbCr & vbCr & psBody & _
vbCr & vbCr & "Regards,"
lsMailTo = _
"mailto:" & gsEmailAdd & _
"?subject=" & HexString(gsSubject) & _
"&body=" & HexString(psBody)
ActiveWorkbook.FollowHyperlink lsMailTo
Function HexString(psStr) As String
Dim liIndex As Long
Dim lsChar As String
Dim lsHex As String
For liIndex = 1 To Len(psStr)
lsChar = Mid(psStr, liIndex, 1)
If IsNumeric(lsChar) Or IsChar(lsChar) Then
HexString = HexString + lsChar
Else
lsHex = Hex(Asc(lsChar))
If Len(lsHex) = 1 Then
lsHex = "0" & lsHex
End If
HexString = HexString + "%" + lsHex
End If
Next
End Function
My code is probably overkilling which characters need to be converted to
hex (e.g. a comma would definately cause a run time error) but I am
curious to get this working please
upgraded to 2003 I am struggling with the below if the length of
lsMailTo is longer than 1033 characters (what a strange number)
psBody = "Hello " & gsFirstName & vbCr & vbCr & psBody & _
vbCr & vbCr & "Regards,"
lsMailTo = _
"mailto:" & gsEmailAdd & _
"?subject=" & HexString(gsSubject) & _
"&body=" & HexString(psBody)
ActiveWorkbook.FollowHyperlink lsMailTo
Function HexString(psStr) As String
Dim liIndex As Long
Dim lsChar As String
Dim lsHex As String
For liIndex = 1 To Len(psStr)
lsChar = Mid(psStr, liIndex, 1)
If IsNumeric(lsChar) Or IsChar(lsChar) Then
HexString = HexString + lsChar
Else
lsHex = Hex(Asc(lsChar))
If Len(lsHex) = 1 Then
lsHex = "0" & lsHex
End If
HexString = HexString + "%" + lsHex
End If
Next
End Function
My code is probably overkilling which characters need to be converted to
hex (e.g. a comma would definately cause a run time error) but I am
curious to get this working please