Send SMS from VBA (1 Viewer)

darbid

Registered User.
Local time
Today, 20:42
Joined
Jun 26, 2008
Messages
1,428
#19 My customer doesn't accept that. I just have to find a different provider, that's all. I have found some, but at higher rates, although still better than eg. Skype.
That cannot be. There must be a way for it to accept these unicode characters especially if they work from their own software.

Try writing to them.
Try searching in swedish - of if you are German in google.de.

I doubt very much that it simply does not work.
 

spikepl

Eledittingent Beliped
Local time
Today, 20:42
Joined
Nov 3, 2010
Messages
6,142
#21 I have no doubts - their customer service puts the emails concerning such problems into a black hole, judging by the German fora. I see no point in wasting time on educating providers - it's easier to find another :) Even some clients (ie. s/w to be installed for Voip and SMS) that Betamax offers suffer from the same problem, likewise if one tries to send SMS from their webpage. So bye bye Betamax in this context :)
 

JANR

Registered User.
Local time
Today, 20:42
Joined
Jan 21, 2009
Messages
1,623
@Spikepl

Did you resolve the problem with special characters like ÆØÅ and others? if not then this function might help. I use it myself to encode SMS messages before I send it to my provider.

Code:
Public Function URLEncode(StringVal As String, Optional SpaceAsPlus As Boolean = False) As String
    Dim StringLen As Long: StringLen = Len(StringVal)
    If StringLen > 0 Then
    
    ReDim result(StringLen) As String
    Dim i As Long, CharCode As Integer
    Dim Char As String, Space As String
    
    If SpaceAsPlus Then Space = "+" Else Space = "%20"
    For i = 1 To StringLen
    Char = Mid$(StringVal, i, 1)
    CharCode = Asc(Char)
    
        Select Case CharCode
            Case 97 To 122, 65 To 90, 48 To 57, 45, 46, 95, 126
                result(i) = Char
            Case 32
                result(i) = Space
            Case 0 To 15
                result(i) = "%0" & Hex(CharCode)
            Case Else
                result(i) = "%" & Hex(CharCode)
        End Select
    Next i
    URLEncode = Join(result, "")
   End If
End Function

JR
 

spikepl

Eledittingent Beliped
Local time
Today, 20:42
Joined
Nov 3, 2010
Messages
6,142
Thx. I bypassed the problem by choosing an SMS gateway provider that accepts "weird" characters.
 

Petrosf

New member
Local time
Today, 21:42
Joined
Nov 6, 2013
Messages
2
Hi, I am new to access VBA and trying to use it to send SMS messages. My problem is sending Greek messages.

I am looking for a code that will convert the greek text to Hex code. For example the greek "Γ" (Gamma) should return a result %CE%93.

I was hoping that the code provided by JANR would do so but instead it returns %C3

The code used is:
Option Compare Database

Public Function URLEncode() As String

Dim StringVal As String
Dim SpaceAsPlus As Boolean
SpaceAsPlus = False
StringVal = "Ã"

Dim StringLen As Long: StringLen = Len(StringVal)
If StringLen > 0 Then

ReDim Result(StringLen) As String
Dim i As Long, CharCode As Integer
Dim Char As String, Space As String

If SpaceAsPlus Then Space = "+" Else Space = "%20"
For i = 1 To StringLen
Char = Mid$(StringVal, i, 1)
CharCode = Asc(Char)

Select Case CharCode
Case 97 To 122, 65 To 90, 48 To 57, 45, 46, 95, 126
Result(i) = Char
Case 32
Result(i) = Space
Case 0 To 15
Result(i) = "%0" & Hex(CharCode)
Case Else
Result(i) = "%" & Hex(CharCode)
End Select
Next i
URLEncode = Join(Result, "")
End If

Debug.Print URLEncode

End Function


Any ideas as to how I can get the result i need?

Hope someone can help :)
 

CJ_London

Super Moderator
Staff member
Local time
Today, 19:42
Joined
Feb 19, 2013
Messages
16,653
I'm sorry I can't help on this one, however you have posted to an old post about sending SMS from VBA whereas your question is about converting greek text to hex code.

My advice would be to start a new thread with 'converting greek text to hex code' in your title. In this way you will attract people who can help with this particular issue. By all means provide a link back to this thread if this is relevant
 

Petrosf

New member
Local time
Today, 21:42
Joined
Nov 6, 2013
Messages
2
CJ, Thanks for the advice. Luckily I was finally able to resolve the issue last night!

Petros:)
 

Users who are viewing this thread

Top Bottom