Sending SMS by VBA Code

Sachin2k6

Active Member
Joined
Mar 3, 2012
Messages
369
Hi all,

Sorry for violating the forum rules but i have to restart the thread as the original have a lot of confusing replies.

I'm working on a management program for a small company. As one of it's feature i need a procedure which send a prewritten SMS to it's employees using a web service like 160by2.com (10 employees at a time.).

After a long search in forum, with the help of found codes i managed the following code and login successfully on the site 160by2.com


Code:
[I]Sub SendSMS()

Const cURL = "http:\\www.160by2.com"
Const cUsername = "XXXXX" 'REPLACE XXXX WITH YOUR USER NAME
Const cPassword = "YYYYY" 'REPLACE YYYY WITH YOUR PASSWORD

Dim IE As InternetExplorer
Dim doc As HTMLDocument
Dim LoginForm As HTMLFormElement
Dim UserNameInputBox As HTMLInputElement
Dim PasswordInputBox As HTMLInputElement
Dim SignInButton As HTMLInputButtonElement
Dim HTMLelement As IHTMLElement

Set IE = New InternetExplorer

IE.Visible = True
IE.navigate cURL

'Wait for initial page to load

Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop

Set doc = IE.document

'Get the only form on the page

Set LoginForm = doc.forms(0)

'Get the User Name textbox and populate it

Set UserNameInputBox = LoginForm.elements("username")
UserNameInputBox.Value = cUsername

'Get the password textbox and populate it

Set PasswordInputBox = LoginForm.elements("password")
PasswordInputBox.Value = cPassword

'Get the form input button and click it

Set SignInButton = LoginForm.elements("button")
SignInButton.Click

'Wait for the new page to load

Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop


'Login succeeded here.

End Sub
[/I]

But to proceed further and access the send sms page i can't get the elements of the next page to click that.

How this code can be extended to access send sms page and send an sms to a particular number(s)????
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hi all,
But to proceed further and access the send sms page i can't get the elements of the next page to click that.

How this code can be extended to access send sms page and send an sms to a particular number(s)????
This is impossible to answer without looking at the webpage source code.
 
Upvote 0
I looked out the source code and able to get the form elements on the page. but next page link is a row header. I do not know the way how to access this control and then click it by code. This was my original question.
 
Upvote 0
your original question was clear and impossible to answer. Please understand that asking how to access "this control" without providing any info about it, i.e. the source code, is not going to get your your question answered.
 
Upvote 0
your original question was clear and impossible to answer. Please understand that asking how to access "this control" without providing any info about it, i.e. the source code, is not going to get your your question answered.

Any one having an account on the site can see the source code by logging in.
 
Upvote 0
Noone is going to sign up to the site just to help you out with this request. If you want help, you're going to need to post the full html of the page behind the log in, even then though you'd be much better off finding an xml/rest web service that offers sms sending as I suggested - makes things much easier
 
Upvote 0
Here is the part of page source code which contains the item 'Send SMS' Id ="psend" in row header ,which shoud be clicked
HTML:
		<nav class="main-nav">
			<span class="hi-msg">
				<p class="hi">Hi </p>
				<p>9997602488</p>
			</span><!-- 
		--><ul class="nav">
				<li><a  id="phome" *******="openPage('Home?id=6ACF3CB0FAAE38DE4C0D503AFB370FF9.8503');" >Home</a></li><!--
			--><li><a  id="psend" *******="openPage('SendSMS?id=6ACF3CB0FAAE38DE4C0D503AFB370FF9.8503');" >Send SMS</a></li><!--
			--><li><a  id="pcug" *******="openPage('CUGHome?id=6ACF3CB0FAAE38DE4C0D503AFB370FF9.8503');" >Group SMS</a></li><!--
			--><li><a  id="pbox" *******="openPage('SentBox?id=6ACF3CB0FAAE38DE4C0D503AFB370FF9.8503');"> Sent Box</a></li><!--
			--><li><a  id="pcont" *******="openPage('Contacts?id=6ACF3CB0FAAE38DE4C0D503AFB370FF9.8503');">Contacts</a></li><!--
			--><li><a  id="palert" *******="openPage('SMSAlerts?id=6ACF3CB0FAAE38DE4C0D503AFB370FF9.8503');">SMS Alert</a></li><!--
			--><li><a  id="psms" *******="openPage('SmsBundle?id=6ACF3CB0FAAE38DE4C0D503AFB370FF9.8503');">SMS Collection</a></li><!--
			--><li><a  id="pset" *******="openPage('UserSettings?id=6ACF3CB0FAAE38DE4C0D503AFB370FF9.8503');">Settings</a></li><!--
			--><li><a  *******="openPage('Logout');">Logout</a></li>				
			</ul>
		</nav>



[HTML]
 
Upvote 0

Forum statistics

Threads
1,215,256
Messages
6,123,915
Members
449,132
Latest member
Rosie14

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top