Get Notifications for All TheFly Stock News as Texts with Excel
Posted by Nonaluuluu on Saturday, May 30, 2020 · Leave a Comment
I'm a fan of https://thefly.com/news.php stock news. I don't like to waste energy looking for news stories or missing out on big events, so I set up the below program. This program runs on a computer in your house. It texts your phone only when TheFly posts a new stock news story.
A cool feature of the iPhone is that you can go to:
1 – Notifications –> Announce Messages with Siri (ON)
2 – Notifications –> Messages –> Announce Messages with Siri (ON)
By turning this iPhone feature on, you can have Siri read your text messages to you if your phone is locked and you have one airpod or powerbeat headphone in your ear. In other words, you can basically get live updates from TheFly website without having to look immediately with this Excel VBA program that I built that you can downoad below:
The code from my workbook is below. How it basically works is it loads wherever your Google Chrome browser is, opens the browser, goes to the website, copies the story into Excel to check if it's new or not, and if it's new then it sends an email as a text message to your phone. Just leave your computer on all week and it can text you anytime there's a new story. I recommend becoming a member of TheFly website to remove ads and so that you can copy the full story. They're a great source for news it's definitely worth the subscription price.
Please note the below ways to ^c (Copy), ^V (Paste), and ~ (ENTER) with VBA. You can use these in addition to the mouse clicks I show below to navigate the web and gather or enter information with VBA programs.
'Application.SendKeys ("^c") 'Sends Control+C to browser to copy
'Application.SendKeys ("^v") 'Sends Control+V to browser to paste
'Application.SendKeys ("~") 'Sends Enter to browser
'Application.SendKeys ("{NUMLOCK}") 'NUMLOCK per insider trading video
Full Code for clicking mouse, copying and pasting, and texting stock news to your phone:
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Private Const MOUSEEVENTF_MIDDLEDOWN = &H20 ' middle button down
Private Const MOUSEEVENTF_MIDDLEUP = &H40 ' middle button up
Private Const MOUSEEVENTF_RIGHTDOWN = &H8 ' right button down
Private Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up
Option Explicit
Public Type POINTAPI
X As Long
Y As Long
End Type
Public Declare Function SetCursorPos Lib "User32.dll" (ByVal X As Integer, ByVal Y As Integer) As Long
Public Declare Function GetCursorPos Lib "User32.dll" (ByRef lpPoint As POINTAPI) As Long
Public Declare Sub mouse_event Lib "user32" ( _
ByVal dwFlags As Long, _
ByVal dx As Long, _
ByVal dy As Long, _
ByVal cButtons As Long, _
ByVal dwExtraInfo As Long)
Private Sub Example()
Dim CurrentPosition As POINTAPI
Dim goku As Double
Do Until goku > 10000000
Dim vPID As Variant
'Variation 1:
vPID = Shell("C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe -URL https://thefly.com/news.php", vbNormalFocus)
Application.Wait (Now + TimeValue("00:00:06"))
SetCursorPos 455, 475 'x and y position
Call GetCursorPos(CurrentPosition)
Call mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
SetCursorPos 750, 640 'x and y position
Application.Wait (Now + TimeValue("00:00:01"))
Application.SendKeys ("^c")
Application.Wait (Now + TimeValue("00:00:01"))
Application.SendKeys ("{NUMLOCK}")
Call mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
Workbooks("MouseClickTheFly2.xlsm").Activate
Sheets("Sheet1").Select
Range("A1").Select
ActiveSheet.Paste
If Sheets("Sheet1").Range("A1").Value = Sheets("sheet2").Range("a1").Value Then
GoTo line33:
Else
Sheets("Sheet2").Select
Selection.ClearContents
Sheets("Sheet1").Select
Range("a1").Select
Selection.Copy
Sheets("sheet2").Select
Range("A1").Select
ActiveSheet.Paste
Dim vari As String
vari = Range("a1").Value
Dim outapp As Object
Dim outmail As Object
Set outapp = CreateObject("Outlook.application")
Set outmail = outapp.createitem(0)
On Error Resume Next
With outmail
.to = "PHONENUMBERHERE@messaging.sprintpcs.com"
.cc = ""
.bcc = ""
.Subject = "newflystory"
.body = vari
.display
.send
End With
On Error GoTo 0
Set outmail = Nothing
Set outapp = Nothing
End If
line33:
SetCursorPos 1900, 20 'x and y position
Application.Wait (Now + TimeValue("00:00:01"))
Call GetCursorPos(CurrentPosition)
Call mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
Call mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
Application.Wait (Now + TimeValue("00:00:01"))
goku = goku + 1
Loop
End Sub