Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JohnLaTwC/5ee2cf46494cd41ae9d857944242a654 to your computer and use it in GitHub Desktop.
Save JohnLaTwC/5ee2cf46494cd41ae9d857944242a654 to your computer and use it in GitHub Desktop.
XLSM Emoji Updater
## Uploaded by @JohnLaTwC
## b266616fd50a57a4b112708a0f3997fce06bb9c3f14a9ea55900925ffe3e264c
## ===============================================================================
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Worksheets("EmojiUpdate").Visible = True
ThisWorkbook.Worksheets("BlankSheet").Visible = False
Workbooks("AutoUpdate.xlsm").Close False
End Sub
Private Sub Workbook_Open()
ThisWorkbook.Worksheets("EmojiUpdate").Activate
Range("j3:j5").Clear
End Sub
-------------------------------------------------------------------------------
VBA MACRO גיליון1.cls
in file: xl/vbaProject.bin - OLE stream: 'VBA/גיליון1'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(empty macro)
-------------------------------------------------------------------------------
VBA MACRO Module1.bas
in file: xl/vbaProject.bin - OLE stream: 'VBA/Module1'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Public Const UserVersion = "3.0"
Public CurrentVersionFromWeb As String 'מספק רק את המספר גירסה
Public WebVersionName As String ' נותן את שם הקובץ להורדה
Sub update() 'למשתמש שמבצע עדכון
ThisWorkbook.Worksheets("EmojiUpdate").Visible = True
ThisWorkbook.Worksheets("BlankSheet").Visible = False
Call GetCurrentVersionFromWeb
If CurrentVersionFromWeb > UserVersion Then
Dim Answer As Integer
Answer = MsgBox("You are currently using version: " & UserVersion & " and the web version is: " & CurrentVersionFromWeb & _
vbNewLine & " would you like to update?", vbYesNo + vbQuestion, "Emoji for Outlook - Update")
If Answer = vbYes Then
WebVersionName = "Emoji_" & CurrentVersionFromWeb & ".zip"
Call CloseOutlook
Call IfFileInFolder
Call DownloadUpdateFile
Call Unzip3
Call renameOldProjectFile
Call Copy_One_File
Call Success
Else
MsgBox "You chose not to update." & _
vbNewLine & "When you change your mind, we'll be right here..", , "Emoji for Outlook - Update"
Exit Sub
End If
Else
MsgBox "You are using our latest version.. There is no need to update", , "Emoji for Outlook - Update"
End If
End Sub
Sub GetCurrentVersionFromWeb()
mytime = Format(Time, "hhmmss")
mydate = Format(Date, "ddmmyyyy")
TimeDate = mydate & mytime
Dim myIE As Object
Set myIE = CreateObject("MSXML2.XMLHTTP")
myIE.Open "GET", "https://www.emojiforoutlook.com/Emoji/Versions/EmojiVersion.html?n=" & TimeDate, False
myIE.Send
While myIE.ReadyState <> 4
DoEvents
Wend
Dim HTMLDoc As Object
Dim HTMLBody As Object
Set HTMLDoc = CreateObject("htmlfile")
Set HTMLBody = HTMLDoc.Body
HTMLBody.innerHTML = myIE.responseText
CurrentVersionFromWeb = HTMLBody.getElementsByTagName("h1")(0).innerText
Set myIE = Nothing
Set HTMLDoc = Nothing
Set HTMLBody = Nothing
Exit Sub
err:
MsgBox "Oops its seems that something went wrong..." & vbNewLine & _
"--Error occurred while trying to get emoji version from web." & vbNewLine & _
"--Please make sure you can access the internet and try again." & vbNewLine & _
"Error Number: " & err.Number
ErrorOccurred = 1
Set myIE = Nothing
Set HTMLDoc = Nothing
Set HTMLBody = Nothing
End Sub
Sub CloseOutlook()
Dim OL As Object
On Error Resume Next
Set OL = GetObject(, "Outlook.Application")
On Error GoTo 0
For i = 1 To 10
If OL Is Nothing Then
' MsgBox "Outlook is not running!" & i
Else
On Error Resume Next
Unload OL.UserForm1
Unload OL.EmojiUserForm1
OL.Quit
End If
Next i
End Sub
Sub IfFileInFolder()
'בודק אם כבר קיים קובץ התקנה
Dim rRange As Range, rCell As Range
Dim strPath As String
strPath = Environ("UserProfile") & "\Downloads\" & WebVersionName
If Dir(strPath) <> vbNullString Then
' MsgBox "Kill MacroFile"
Kill (strPath)
End If
End Sub
Sub DownloadUpdateFile()
'הורדת קובץ זיפ מהאינטרנט
Dim myURL As String
myURL = "https://www.emojiforoutlook.com/Emoji/Versions/" & WebVersionName
Dim WinHttpReq As Object
Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
WinHttpReq.Open "GET", myURL, False
WinHttpReq.Send
myURL = WinHttpReq.responseBody
If WinHttpReq.Status = 200 Then
Set oStream = CreateObject("ADODB.Stream")
oStream.Open
oStream.Type = 1
oStream.Write WinHttpReq.responseBody
oStream.SaveToFile (Environ("UserProfile") & "\Downloads\" & WebVersionName)
oStream.Close
End If
Application.Wait (Now + TimeValue("0:00:05"))
' MsgBox "Download is finished" & vbNewLine & "Installing now", , "Emoji for Outlook"
End Sub
Sub Unzip3()
'חילוץ קובץ זיפ
Dim FSO As Object
Dim oApp As Object
Dim Fname As Variant
Dim FileNameFolder As Variant
Dim DefPath As String
Fname = Environ("UserProfile") & "\Downloads\" & WebVersionName
' Fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip), *.zip", _
MultiSelect:=False)
If Fname = False Then
'Do nothing
Else
'Destination folder
DefPath = Environ("UserProfile") & "\Pictures"
If Right(DefPath, 1) <> "\" Then
DefPath = DefPath & "\"
End If
FileNameFolder = DefPath
' 'Delete all the files in the folder DefPath first if you want
' On Error Resume Next
' Kill DefPath & "*.*"
' On Error GoTo 0
'Extract the files into the Destination folder
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(Fname).Items, &H10&
'MsgBox "You find the files here: " & FileNameFolder
On Error Resume Next
Set FSO = CreateObject("scripting.filesystemobject")
FSO.deletefolder Environ("Temp") & "\Temporary Directory*", True
End If
End Sub
Sub renameOldProjectFile()
'בודק אם הקובץ פרויקט אווטלוק קיים
'אם כן מגבה אותו נכון להיום
On Error GoTo err
FileExists = Environ("UserProfile") & "\AppData\Roaming\Microsoft\Outlook\VbaProject.OTM"
If Dir(FileExists) <> "" Then
Dim LValue As String
LValue = Format(Now, "dd.mm.yyyy-hh.mm.ss")
GivenLocation = Environ("UserProfile") & "\AppData\Roaming\Microsoft\Outlook\" 'note the trailing backslash
OldFileName = "VbaProject.OTM"
NewFileName = "VbaProject" & LValue & ".OTM"
Name GivenLocation & OldFileName As GivenLocation & NewFileName
End If
Exit Sub
err:
MsgBox "Oops its seems that something went wrong..." & vbNewLine & _
"--Please make sure that outlook is close and try again."
End Sub
Sub Copy_One_File()
'מעתיק את קובץ פרויקט אווטלוק החדש
Dim SourceLocation As String
Dim DestinationLocation As String
SourceLocation = Environ("UserProfile") & "\Pictures\Emoji\DB\"
DestinationLocation = Environ("UserProfile") & "\AppData\Roaming\Microsoft\Outlook\"
FileCopy SourceLocation & "VbaProject.OTM", DestinationLocation & "VbaProject.OTM"
End Sub
Sub Success()
ThisWorkbook.Worksheets("EmojiUpdate").Range("J3").Value = "If the update does not start automatically, click the button below"
ThisWorkbook.Worksheets("EmojiUpdate").Range("J4").Value = "Make sure that you have enabled excel to run macros."
ThisWorkbook.Worksheets("EmojiUpdate").Range("J5").Value = "(Go to Options -> Trust Center -> Trust Center Settings -> Enable all macros)"
ThisWorkbook.Worksheets("BlankSheet").Range("f3").Value = "the update installed successfully."
ThisWorkbook.Worksheets("BlankSheet").Range("f4").Value = "you can restart Outlook"
End Sub
## ===============================================================================
-------------------------------------------------------------------------------
VBA MACRO גיליון2.cls
in file: xl/vbaProject.bin - OLE stream: 'VBA/גיליון2'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(empty macro)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Const AccessConStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="
Const AccessConStr2 As String = "\Pictures\Emoji\DB\EmojiDB.mdb;Persist Security Info=False;"
Public LastCheckted As Date
Function importFavorite()
'יבא מעודפים לתוך רשימה
Dim Cnn As Object
Dim rst As Object
Dim i As Integer
Set Cnn = CreateObject("ADODB.Connection")
Set rst = CreateObject("ADODB.Recordset")
Cnn.ConnectionString = AccessConStr & Environ("USERPROFILE") & AccessConStr2
Cnn.Open
'לרשימה הראשונה
rst.Open "SELECT [NumOfClicks],[EmojiNum],[ID] FROM EmojiDBWeb ORDER BY [ID] ASC;", _
Cnn, adOpenStatic
rst.MoveFirst
i = 0
With frmEmoji.ListBox1
.Clear
Do
.AddItem
.List(i, 0) = rst![EmojiNum]
.List(i, 1) = rst![NumOfClicks]
' .List(i, 2) = rst![ID]
i = i + 1
rst.movenext
Loop Until rst.EOF
End With
rst.Close
'לרשימה השנייה
rst.Open "SELECT [EmojiNum],[NumOfClicks] FROM EmojiDBWeb ORDER BY [EmojiNum] DESC,[NumOfClicks] ASC;", _
Cnn, adOpenStatic
rst.MoveFirst
i = 0
With frmEmoji.ListBox2
.Clear
Do
.AddItem
.List(i, 0) = rst![EmojiNum]
.List(i, 1) = rst![NumOfClicks]
i = i + 1
rst.movenext
Loop Until rst.EOF
End With
rst.Close
'בדיקה האם יש עדכון לתוכנה
With rst
.ActiveConnection = Cnn
.source = "SetingsT"
.LockType = 3 'adLockOptimistic 'לבחור כשרוצים לשנות רשומות בטבלה'
.CursorType = 0 'adOpenForwardOnly 'בודק איזה שינויים בוצעו בטבלה, פורוורד אונלי הוא זה שמבזבז הכי פחות משאבים'
.Open
' On Error GoTo SkipWhenNull
LastCheckted = .Fields.Item(1).Value
AccessVersionNumber = .Fields.Item(2).Value
WinWidth = .Fields.Item(7).Value
WinHeight = .Fields.Item(8).Value
ZoomNum = .Fields.Item(9).Value
IsCustom = .Fields.Item(11).Value
IsLoadTime = True
Call WinSize_Initialize 'גודל התוסף
Call WinSizeByDPI 'ביצוע התאמות לתוסף
IsLoadTime = False
End With
SkipWhenNull:
frmEmoji.lblTimeToAlert.Caption = Now - 1
If AccessVersionNumber > UserVersion And LastCheckted < Now Then ' ככה זה צריך להיות בסוף
frmUpdate.lblLastCheckted.Caption = LastCheckted
frmUpdate.lblVersionNumber.Caption = WebVersionNumber
frmUpdate.Show
End If
rst.Close
Cnn.Close
Set rst = Nothing
Set Cnn = Nothing
End Function
'-----------------------------------------------------------------------------
Function SaveFavToAccess()
'בסגירת התוסף
'מייצא חזרה לקובץ אקסס
Dim Conn As Object
Dim RstData As Object
Dim RstData2 As Object
Dim iCnt As Integer
Set Conn = CreateObject("ADODB.Connection")
Set RstData = CreateObject("ADODB.Recordset")
Set RstData2 = CreateObject("ADODB.Recordset")
Conn.ConnectionString = AccessConStr & Environ("USERPROFILE") & AccessConStr2
Conn.Open
On Error GoTo CloseConnection
With RstData
.ActiveConnection = Conn
.source = "EmojiDBWeb"
.LockType = 3 'adLockOptimistic 'לבחור כשרוצים לשנות רשומות בטבלה'
.CursorType = 0 'adOpenForwardOnly 'בודק איזה שינויים בוצעו בטבלה, פורוורד אונלי הוא זה שמבזבז הכי פחות משאבים'
.Open
On Error GoTo CloseRecordset
iCnt = 0
'.BOF 'תחילת הטבלה
Do Until .EOF 'עשה עד לשורה האחרונה
.Fields("EmojiNum").Value = frmEmoji.ListBox1.List(iCnt)
.Fields("NumOfClicks").Value = frmEmoji.ListBox1.List(iCnt, 1)
.update
iCnt = iCnt + 1
.movenext
Loop
.MoveFirst ' כדי להימנע משגיאה בcancelUpdate
End With
If LastCheckted < Now Then ' בסוף להוסיף כשנבדק לאחרונה + 3 ימים
Call GetCurrentVersionFromWeb 'בודק את המספר גירסה באינטרנט
'--------------
With RstData2
.ActiveConnection = Conn
.source = "SetingsT"
.LockType = 3 'adLockOptimistic 'לבחור כשרוצים לשנות רשומות בטבלה'
.CursorType = 0 'adOpenForwardOnly 'בודק איזה שינויים בוצעו בטבלה, פורוורד אונלי הוא זה שמבזבז הכי פחות משאבים'
.Open
.Fields.Item(1).Value = frmEmoji.lblTimeToAlert.Caption
.Fields.Item(2).Value = WebVersionNumber
.Fields.Item(7).Value = WinWidth
.Fields.Item(8).Value = WinHeight
.Fields.Item(9).Value = ZoomNum
.Fields.Item(11).Value = IsCustom
If .Fields.Item(6).Value = False Then
Call ChackForNewUser
If NewUserValidation = True Then .Fields.Item(6).Value = True
End If
.update
.Close
End With
' myIE.Quit
' Set myIE = Nothing
' Set myIEDoc = Nothing
End If
CloseRecordset:
RstData.CancelUpdate
RstData.Close
CloseConnection:
Conn.Close
Set RstData = Nothing
Set RstData2 = Nothing
Set Conn = Nothing
End Function
-------------------------------------------------------------------------------
VBA MACRO mdlEmoji.bas
in file: VbaProject.OTM - OLE stream: 'OutlookVbaData/VBA/mdlEmoji'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Public Const UserVersion = "3.1"
Public WebVersionNumber As String
Public whatsNew As String
Public NewUserValidation As Boolean
Public WinWidth As Integer
Public WinHeight As Integer
Public ZoomNum As Integer
Public IsCustom As String
Public IsLoadTime As Boolean
'for web browser zoom
Private Const OLECMDID_OPTICAL_ZOOM As Long = 63
Private Const OLECMDEXECOPT_DONTPROMPTUSER As Long = 2
'Functions to get DPI
Private Declare PtrSafe Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare PtrSafe Function GetDeviceCaps Lib "gdi32" (ByVal hDC As Long, ByVal nIndex As Long) As Long
Private Const LOGPIXELSX = 88 'Pixels/inch in X
Sub showEmoji()
Call openStartUserForm
End Sub
Function openStartUserForm()
frmStart.Show
End Function
Function openFrmResize()
frmResize.Show vbModeless
End Function
Function WinSize_Initialize() 'רץ פעם אחת בכל העלאה של האימוגי
frmEmoji.Width = WinWidth
frmEmoji.WBmain.Width = WinWidth - 10
frmEmoji.Height = WinHeight
frmEmoji.WBmain.Height = WinHeight - 10
End Function
Function WinSizeByDPI() 'מוצא את הדי פי אי של המסך.
'96 -100% || 120 - 125% || 144 - 150% || 168 - 175%
Dim hDC As Long
Dim lDotsPerInch As Long
hDC = GetDC(0)
lDotsPerInch = GetDeviceCaps(hDC, LOGPIXELSX) 'the DPI
If IsCustom = "yes" Then
Call ZoomPage("N")
Else
If lDotsPerInch = 120 Then 'עבור מסכים ברזולוציה של 120 אחוז
Call ZoomPage("150")
ElseIf lDotsPerInch = 144 Then 'עבור מסכים ברזולוציה של 150 אחוז
Call ZoomPage("190")
ElseIf lDotsPerInch = 168 Then 'עבור מסכים ברזולוציה של 175 אחוז
Call ZoomPage("250")
Else 'עבור מסכים ברזולוציה של 100 אחוז
Call ZoomPage("Default")
End If
End If
End Function
Function ZoomPage(zoom)
Dim ZoomScale As Variant
Dim Num As Integer
Num = 10
On Error GoTo err
If zoom = "ZoomP" Then
ZoomNum = ZoomNum + Num
ElseIf zoom = "ZoomM" Then
ZoomNum = ZoomNum - Num
ElseIf zoom = "Default" Then
ZoomNum = 100
ElseIf zoom = "150" Then
ZoomNum = 150
ElseIf zoom = "190" Then
ZoomNum = 190
ElseIf zoom = "250" Then
ZoomNum = 250
End If
If ZoomNum > 250 Then
MsgBox "you have reached maximum zoom size", , "Emoji for Outlook"
ZoomNum = 250
Exit Function
ElseIf ZoomNum < 50 Then
MsgBox "you have reached minimum zoom size", , "Emoji for Outlook"
ZoomNum = 50
Exit Function
End If
Select Case ZoomNum
Case Is >= 250
ZoomScale = 250&
Case Is >= 240
ZoomScale = 240&
Case Is >= 230
ZoomScale = 230&
Case Is >= 220
ZoomScale = 220&
Case Is >= 210
ZoomScale = 210&
Case Is >= 200
ZoomScale = 200&
Case Is >= 190
ZoomScale = 190&
Case Is >= 180
ZoomScale = 180&
Case Is >= 170
ZoomScale = 170&
Case Is >= 160
ZoomScale = 160&
Case Is >= 150
ZoomScale = 150&
Case Is >= 140
ZoomScale = 140&
Case Is >= 130
ZoomScale = 130&
Case Is >= 120
ZoomScale = 120&
Case Is >= 110
ZoomScale = 110&
Case Is >= 100
ZoomScale = 100&
Case Is >= 90
ZoomScale = 90&
Case Is >= 80
ZoomScale = 80&
Case Is >= 70
ZoomScale = 70&
Case Is >= 60
ZoomScale = 60&
Case Is >= 50
ZoomScale = 50&
Case Else
ZoomScale = 100&
End Select
frmEmoji.WBmain.ExecWB OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, ZoomScale
Exit Function
err:
If Not IsLoadTime = True Then Beep
End Function
Function ChackForNewUser()
Dim IE As Object
Dim FormPage As String
NewUserValidation = False
Dim olNS As Outlook.NameSpace
Dim olFol As Outlook.Folder
Set olNS = Outlook.GetNamespace("MAPI")
Set olFol = olNS.GetDefaultFolder(olFolderInbox)
UserAddress = olFol.Parent.Name '~~> most cases contains the email address
UserAddress2 = olNS.Accounts.Item(1).DisplayName '~~> usually email address
UserAddress3 = olNS.Accounts.Item(1).SmtpAddress '~~> email address
UserName = Application.Session.CurrentUser.Name
FormPage = "https://www.emojiforoutlook.com/form/form.htm"
On Error Resume Next
Set IE = CreateObject("internetexplorer.Application")
With IE
.Navigate FormPage
Do While .Busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
.Document.forms(0).Item(0).Value = UserAddress
.Document.forms(0).Item(1).Value = UserAddress2
.Document.forms(0).Item(2).Value = UserAddress3
.Document.forms(0).Item(3).Value = UserName
.Document.forms(0).Item(4).Value = UserVersion
.Document.forms(0).submit
Do While .Busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
NewUserValidation = True
End With
IE.Quit
Set IE = Nothing
End Function
Function GetCurrentVersionFromWeb()
mytime = Format(Time, "hhmmss")
mydate = Format(Date, "ddmmyyyy")
TimeDate = mydate & mytime
Dim myIE As Object
Set myIE = CreateObject("MSXML2.XMLHTTP")
myIE.Open "GET", "https://www.emojiforoutlook.com/Emoji/Versions/EmojiVersion.html?n=" & TimeDate, False
myIE.Send
While myIE.ReadyState <> 4
DoEvents
Wend
Dim HTMLDoc As Object
Dim HTMLBody As Object
Set HTMLDoc = CreateObject("htmlfile")
Set HTMLBody = HTMLDoc.Body
HTMLBody.innerHTML = myIE.responseText
WebVersionNumber = HTMLBody.getElementsByTagName("h1")(0).innerText
whatsNew = HTMLBody.getElementsByTagName("ul")(0).innerText
' MsgBox myIEDoc.getElementById("CurrentV").innerText
'
'If WebVersionNumber > UserVersion Then
' frmUpdate.Show
'Else
' MsgBox "You are using our leatest version", , "Emoji for Outlook - Update"
'End If
Set myIE = Nothing
Set HTMLDoc = Nothing
Set HTMLBody = Nothing
End Function
Function EmailMe()
'Unload EmojiUserForm2
'שולח מייל אלי
Dim myItem As Object
Set myItem = Application.CreateItem(olMailItem)
On Error GoTo er
myItem.Subject = "Emoji for Outlook - "
myItem.To = "[email protected]"
myItem.Body = vbCrLf & vbCrLf & vbCrLf & vbCrLf & "running version number - " & UserVersion
myItem.Display
Exit Function
er:
MsgBox "Oops... Something went wrong..." & vbNewLine & "Eror # " & CStr(err.Number) _
& vbNewLine & vbNewLine & err.Description
err.Clear
End Function
'-----------------------2.97-------------------------------
Function GetCurrentVersionFromWeb_OLD()
'נתקע על ביזי. אפשר לדלג עם עובר איקס זמן
mytime = Format(Time, "hhmmss")
mydate = Format(Date, "ddmmyyyy")
TimeDate = mydate & mytime
Dim myIE As Object
Dim myIEDoc As Object
On Error Resume Next
Set myIE = CreateObject("InternetExplorer.Application")
myIE.Visible = False
myIE.Navigate "https://whylikethis.github.io/vbaa/EmojiVersion.html?n=" & TimeDate
While myIE.Busy
DoEvents
Wend
Set myIEDoc = myIE.Document
WebVersionNumber = myIEDoc.getElementsByTagName("h1")(0).innerText
whatsNew = myIEDoc.getElementsByTagName("ul")(0).innerText
' MsgBox myIEDoc.getElementById("CurrentV").innerText
'
'If WebVersionNumber > UserVersion Then
' frmUpdate.Show
'Else
' MsgBox "You are using our leatest version", , "Emoji for Outlook - Update"
'End If
myIE.Quit
Set myIE = Nothing
Set myIEDoc = Nothing
End Function
'Function changeWinSize(s) ' הגדלה והקטנה של החלון
'If WinScale >= 1.7 And s = "plus" Then
' MsgBox "you have reached the window maximum size", , "Emoji for Outlook"
'ElseIf WinScale <= 0.7 And s = "minus" Then
' MsgBox "you have reached the window minimum size", , "Emoji for Outlook"
'Else
' If s = "plus" Then
' WinScale = WinScale + 0.05
' ElseIf s = "minus" Then
' WinScale = WinScale - 0.05
' End If
'
'Dim Num As Integer
'Num = 5
'
'' frmEmoji.Width = 280 * WinScale
'' frmEmoji.WBmain.Width = 275 * WinScale
'' frmEmoji.WBads.Width = 275 * WinScale
''
'' frmEmoji.Height = 320 * WinScale
'' frmEmoji.WBmain.Height = 234 * WinScale
'' frmEmoji.WBads.Height = 57.5 * WinScale
'' frmEmoji.WBads.Top = frmEmoji.WBmain.Height
'
''
' frmEmoji.Width = WinWidth + Num
' frmEmoji.WBmain.Width = (WinWidth - Num * 2) + Num
'' frmEmoji.WBads.Width = 355 * WinScale
'
' frmEmoji.Height = WinHeight + Num
' frmEmoji.WBmain.Height = WinHeight + Num
'' frmEmoji.WBads.Height = 57.5 * WinScale
'' frmEmoji.WBads.Top = 285 * WinScale
'End If
'End Function
-------------------------------------------------------------------------------
VBA MACRO frmUpdate.frm
in file: VbaProject.OTM - OLE stream: 'OutlookVbaData/VBA/frmUpdate'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Const AccessConStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="
Const AccessConStr2 As String = "\Pictures\Emoji\DB\EmojiDB.mdb;Persist Security Info=False;"
Dim NextTimeToAlert As Date
Private Sub UserForm_Initialize()
Call GetCurrentVersionFromWeb
txtWhatsNew.Text = whatsNew
txtWhatsNew.SetFocus
txtWhatsNew.CurLine = 0 'שם את הסמן בנקודה אפס
With Me.ComboBox1
.AddItem "10 Minutes"
.AddItem "30 Minutes"
.AddItem "1 Hour"
.AddItem "2 Hours"
.AddItem "4 Hours"
.AddItem "1 Day"
.AddItem "2 Days"
End With
End Sub
Private Sub StartUpdateButton_Click() 'פתח קובץ אקסל והתחל בעדכון
Dim strPath As String
strPath = Environ("UserProfile") & "\AppData\Roaming\EmojiForOutlook\Update\AutoUpdate.xlsm"
If Dir(strPath) <> vbNullString Then
Kill (strPath)
End If
Dim SourceLocation As String
Dim DestinationLocation As String
SourceLocation = Environ("UserProfile") & "\Pictures\Emoji\DB\""
DestinationLocation = Environ("UserProfile") & "\AppData\Roaming\EmojiForOutlook\Update\\"
If Dir(Environ("UserProfile") & "\AppData\Roaming\EmojiForOutlook\\", vbDirectory) = "" Then MkDir Environ("UserProfile") & "\AppData\Roaming\EmojiForOutlook\\"
If Dir(DestinationLocation, vbDirectory) = "" Then MkDir DestinationLocation
FileCopy SourceLocation & "AutoUpdate.xlsm", DestinationLocation & "AutoUpdate.xlsm"
Dim OutMail As Object
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Workbooks.Open (DestinationLocation & "AutoUpdate.xlsm")
xlApp.Application.Visible = True
Set xlApp = Nothing
End Sub
'--------------------------------------
'---------בעת ביצוע דחיית התקנה--------
'--------------------------------------
Private Sub RemindMeButton_Click()
'כתוב לקובץ אקסס מתי לבצע תזכורת
Select Case ComboBox1.ListIndex
Case -1: MsgBox "You didn't select anything", , "Emoji for Outlook - Update"
Exit Sub
Case 0: NextTimeToAlert = Now + TimeSerial(0, 10, 0)
Case 1: NextTimeToAlert = Now + TimeSerial(0, 30, 0)
Case 2: NextTimeToAlert = Now + TimeSerial(0, 60, 0)
Case 3: NextTimeToAlert = Now + TimeSerial(0, 120, 0)
Case 4: NextTimeToAlert = Now + TimeSerial(0, 240, 0)
Case 5: NextTimeToAlert = Now + TimeSerial(24, 0, 0)
Case 6: NextTimeToAlert = Now + TimeSerial(48, 0, 0)
End Select
'MsgBox NextTimeToAlert
Call AlartUserAboutUpdate
frmEmoji.lblTimeToAlert.Caption = NextTimeToAlert
Unload Me
End Sub
Function AlartUserAboutUpdate()
' Dim Conn As ADODB.Connection
' Dim RstData As ADODB.Recordset
' Dim iCnt As Integer
' Set Conn = New ADODB.Connection
' Set RstData = New ADODB.Recordset
Dim Conn As Object
Dim RstData As Object
Dim iCnt As Integer
Set Conn = CreateObject("ADODB.Connection")
Set RstData = CreateObject("ADODB.Recordset")
Conn.ConnectionString = AccessConStr & Environ("USERPROFILE") & AccessConStr2
Conn.Open
On Error GoTo CloseConnection
With RstData
.ActiveConnection = Conn
.source = "SetingsT"
.LockType = 3 'adLockOptimistic 'לבחור כשרוצים לשנות רשומות בטבלה'
.CursorType = 0 'adOpenForwardOnly 'בודק איזה שינויים בוצעו בטבלה, פורוורד אונלי הוא זה שמבזבז הכי פחות משאבים'
.Open
On Error GoTo CloseRecordset
'לבצע עדכון בתא ספציפי
.Fields.Item(1).Value = NextTimeToAlert
.update
End With
CloseRecordset:
RstData.CancelUpdate
RstData.Close
CloseConnection:
Conn.Close
Set RstData = Nothing
Set Conn = Nothing
End Function
-------------------------------------------------------------------------------
VBA MACRO frmEmoji.frm
in file: VbaProject.OTM - OLE stream: 'OutlookVbaData/VBA/frmEmoji'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Public EmojiName As String
Public EmojiSize As String
Private Sub btnHardReload_Click() 'כפתור נסתר לצורך בדיקות
WBmain.Refresh
End Sub
Private Sub UserForm_Initialize()
WBmain.RegisterAsBrowser = False
WBgoogle.Navigate "https://www.emojiforoutlook.com/Emoji/EmojiApp3.0/sub2.htm"
'WBads.Navigate "https://www.emojiforoutlook.com/EmojiApp2.97/Pages/ChangeSub.htm"
WBmain.Navigate Environ("UserProfile") & "\Pictures\Emoji\DB\index.htm"
'WBmain.Navigate "https://www.emojiforoutlook.com/EmojiApp2.96/index.htm"
'WBads.Navigate "http://localhost:43538/Pages/ChangeSub.htm"
'main.Navigate "http://localhost:43538/"
'WBmain.Navigate "C:/Users/Itai/Pictures/Emoji/DB/index.htm"
Call importFavorite
End Sub
Private Sub WBmain_DocumentComplete(ByVal pDisp As Object, URL As Variant)
For i = 0 To 30 'מוסיף את המועדפים בפועל לפי הרשימה
EmojiNumOfClicks = frmEmoji.ListBox2.List(i, 0)
If EmojiNumOfClicks > 0 Then
favoriteEmoji = frmEmoji.ListBox2.List(i, 1)
favHTML = favHTML & "<img class='FavoriteEmoji' src='../Web/" & favoriteEmoji & ".png' id='" _
& favoriteEmoji & "' onclick='EmojiClick(event);'>"
Else
favoriteEmoji = "grayStar"
favHTML = favHTML & "<img src='../Web/" & favoriteEmoji & ".png'>"
End If
Next i
'--------
On Error GoTo err
WBmain.Document.Body.Scroll = "no" 'כדי שלא תהיה גלילה
WBmain.Document.getElementById("favorite").innerHTML = favHTML 'הוספת כל המעודפים
Exit Sub
err:
'פה אפשר לעשות עמוד 404 למקרה ומישהו לא מחובר לאינטרנט
'MsgBox "error num: " & err.Number
End Sub
Private Sub WBmain_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
Call ZoomPage("N")
End Sub
Private Sub WBmain_TitleChange(ByVal Text As String) 'Text = מה שכתוב בטייטל
'Debug.Print Text
FirstLetter = Left(Text, 1)
If FirstLetter = "E" Then
'If Text <> "EmojiMain" And Text <> "CheckForUpdate" _
'And Text <> "wSizeMinus" And Text <> "wSizePlus" Then
On Error GoTo err
EmojiSize = WBmain.Document.getElementById("ImgSizeID").innerText
EmojiName = Text 'חייב להיות במשתנה גלובלי
For i = 0 To 2800
If Text = frmEmoji.ListBox1.List(i, 1) Then
frmEmoji.ListBox1.List(i, 0) = frmEmoji.ListBox1.List(i, 0) + 1 ' מספר לחיצות
frmEmoji.ListBox1.List(i, 1) = Text 'הוסף אימוגי מספר
Exit For
End If
Next i
' Debug.Print "TitleChange: " & Text
Call InsertEmoji_HTML
Else
If Text = "wSizeMinus" Then
' changeWinSize ("minus")
Call openFrmResize
ElseIf Text = "wSizePlus" Then
Call openFrmResize
' changeWinSize ("plus")
' ElseIf Text = "wZoomMinus" Then
' ZoomPage ("ZoomM")
' ElseIf Text = "wZoomPlus" Then
' ZoomPage ("ZoomP")
ElseIf Text = "CheckForUpdate" Then
Call GetCurrentVersionFromWeb
If WebVersionNumber = UserVersion Then
MsgBox "You are running the latest version. Woo Hoo!", , "Emoji for Outlook - Update"
ElseIf WebVersionNumber > UserVersion Then
frmUpdate.Show
ElseIf WebVersionNumber < UserVersion Then
MsgBox "that's weird.." & vbNewLine _
& "it seems you got a version from the future.." & vbNewLine _
& "you have version " & UserVersion & " but the latest version is " & WebVersionNumber _
& vbNewLine & "please contact us by e-mail", , "Emoji for Outlook - Update"
End If
End If
End If
err:
End Sub
Sub InsertEmoji_HTML()
EmojiNameFirst = Left(EmojiName, 2)
If EmojiNameFirst = "m_" Then Exit Sub
' מוסיף את התמונה של האימוג'י
On Error GoTo ErrHandler
If TypeName(ActiveWindow) = "Inspector" Then
If ActiveInspector.IsWordMail And ActiveInspector.EditorType = olEditorWord Then
Set Img = ActiveInspector.WordEditor.Application.Selection.InlineShapes.AddPicture(FileName:= _
Environ("USERPROFILE") & "\Pictures\Emoji\Web\" & EmojiName & ".png", LinkToFile:=False, SaveWithDocument:=True)
With Img
.Height = EmojiSize
.Width = EmojiSize
End With
Call forGoogleAnalytics
End If
End If
Exit Sub
ErrHandler:
Beep
End Sub
Sub forGoogleAnalytics()
On Error GoTo 0
WBgoogle.Document.getElementById("forTestsNew").innerHTML = "<div id='" & EmojiName & "' family='" & EmojiName & "' class='emoji'>"
'MsgBox WBgoogle.Document.getElementById("forTestsNew").innerHTML
WBgoogle.Document.getElementById(EmojiName).Click
End Sub
Private Sub UserForm_Terminate()
'בסגירת התוסף
'מייצא חזרה לקובץ אקסס
Call SaveFavToAccess
End Sub
Private Sub WBmain22_StatusTextChange(ByVal Text As String)
End Sub
-------------------------------------------------------------------------------
VBA MACRO frmStart.frm
in file: VbaProject.OTM - OLE stream: 'OutlookVbaData/VBA/frmStart'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Private Sub UserForm_Activate()
Unload Me
frmEmoji.Show vbModeless
End Sub
-------------------------------------------------------------------------------
VBA MACRO mdlReply.bas
in file: VbaProject.OTM - OLE stream: 'OutlookVbaData/VBA/mdlReply'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
'Sub ReplyAllWithAttachmentsSub()
' Call ReplyAllWithAttachments
'End Sub
Function ReplyAllWithAttachments()
Const SCRIPT_NAME = "Reply All With Attachments"
Dim olkMsg As Object, olkRpl As Outlook.MailItem, olkAtt As Outlook.Attachment, strTmp As String
Select Case TypeName(Application.ActiveWindow)
Case "Explorer"
Set olkMsg = Application.ActiveExplorer.Selection(1)
Case "Inspector"
Set olkMsg = Application.ActiveInspector.CurrentItem
Case Else
Set olkMsg = Nothing
End Select
If olkMsg.Class = olMail Then
strTmp = Environ("TEMP") & "\"
Set olkRpl = olkMsg.ReplyAll
For Each olkAtt In olkMsg.Attachments
If Not IsHiddenAttachment(olkAtt) Then
olkAtt.SaveAsFile strTmp & olkAtt.FileName
olkRpl.Attachments.Add strTmp & olkAtt.FileName
Kill strTmp & olkAtt.FileName
End If
Next
olkRpl.Display
Else
MsgBox "This macro only works with emails.", vbCritical + vbOKOnly, SCRIPT_NAME
End If
Set olkMsg = Nothing
Set olkRpl = Nothing
Set olkAtt = Nothing
End Function
Private Function IsHiddenAttachment(olkAtt As Outlook.Attachment) As Boolean
' Purpose: Determines if an attachment is a hidden attachment.
Const PR_ATTACH_CONTENT_ID = "http://schemas.microsoft.com/mapi/proptag/0x3712001E"
Dim olkPA As Outlook.PropertyAccessor, varTemp As Variant
On Error Resume Next
Set olkPA = olkAtt.PropertyAccessor
varTemp = olkPA.GetProperty(PR_ATTACH_CONTENT_ID)
IsHiddenAttachment = (varTemp <> "")
On Error GoTo 0
Set olkPA = Nothing
End Function
-------------------------------------------------------------------------------
VBA MACRO frmResize.frm
in file: VbaProject.OTM - OLE stream: 'OutlookVbaData/VBA/frmResize'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Private Sub UserForm_Initialize()
WBresize.Silent = True
WBresize.Navigate Environ("UserProfile") & "\Pictures\Emoji\DB\Pages\resize.htm"
End Sub
Private Sub WBresize_TitleChange(ByVal Text As String) 'Text = מה שכתוב בטייטל
'Debug.Print Text
On Error GoTo err
Dim Num As Integer
Num = 5
IsCustom = "yes"
If Text = "AppUp" Then
frmEmoji.Height = frmEmoji.Height - Num
frmEmoji.WBmain.Height = frmEmoji.Height - Num - 10
ElseIf Text = "AppDown" Then
frmEmoji.Height = frmEmoji.Height + Num
frmEmoji.WBmain.Height = frmEmoji.Height + Num - 10
ElseIf Text = "AppLeft" Then
frmEmoji.Width = frmEmoji.Width - Num
frmEmoji.WBmain.Width = frmEmoji.Width - Num - Num
ElseIf Text = "AppRight" Then
frmEmoji.Width = frmEmoji.Width + Num
frmEmoji.WBmain.Width = (frmEmoji.Width - Num * 3) + Num
ElseIf Text = "EmojiZoomPlus" Then Call ZoomPage("ZoomP")
ElseIf Text = "EmojiZoomMinus" Then Call ZoomPage("ZoomM")
ElseIf Text = "Reset" Then
frmEmoji.Height = 380
frmEmoji.WBmain.Height = 380 - 10
frmEmoji.Width = 355
frmEmoji.WBmain.Width = 355 - 10
Call ZoomPage("Default")
IsCustom = "no"
End If
WinWidth = frmEmoji.Width
WinHeight = frmEmoji.Height
err:
End Sub
-------------------------------------------------------------------------------
VBA MACRO mdlaa.bas
in file: VbaProject.OTM - OLE stream: 'OutlookVbaData/VBA/mdlaa'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(empty macro)
-------------------------------------------------------------------------------
VBA FORM STRING IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmEmoji/o'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
�hard reload@
-------------------------------------------------------------------------------
VBA FORM STRING IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmEmoji/o'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
�lblTimeToAlert
-------------------------------------------------------------------------------
VBA FORM STRING IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate/o'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
�Label1
-------------------------------------------------------------------------------
VBA FORM STRING IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate/o'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
�Label2
-------------------------------------------------------------------------------
VBA FORM STRING IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate/o'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
�Emoji for Outlook latest version is HERE!!
-------------------------------------------------------------------------------
VBA FORM STRING IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate/o'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
�Yes - Download Now
-------------------------------------------------------------------------------
VBA FORM STRING IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate/o'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
�Remaind Me:
-------------------------------------------------------------------------------
VBA FORM STRING IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate/o'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
�Not now, But remind me the next time I open the add-on, when the minimum time is:
-------------------------------------------------------------------------------
VBA FORM STRING IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate/o'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
�Would you like to download it now?
-------------------------------------------------------------------------------
VBA FORM STRING IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate/o'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
�WHAT'S NEW:
ERROR: Unsupported stored type in user form: 32768
-------------------------------------------------------------------------------
VBA FORM Variable "b'btnHardReload'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmEmoji'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
-------------------------------------------------------------------------------
VBA FORM Variable "b'lblTimeToAlert'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmEmoji'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
-------------------------------------------------------------------------------
VBA FORM Variable "b'WBads'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmEmoji'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
-------------------------------------------------------------------------------
VBA FORM Variable "b'WBgoogle'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmEmoji'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
-------------------------------------------------------------------------------
VBA FORM Variable "b'WBmain'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmEmoji'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
-------------------------------------------------------------------------------
VBA FORM Variable "b'ListBox2'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmEmoji'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
-------------------------------------------------------------------------------
VBA FORM Variable "b'ListBox1'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmEmoji'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
ERROR: Unsupported stored type in user form: 32768
-------------------------------------------------------------------------------
VBA FORM Variable "b'WBresize'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmResize'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
-------------------------------------------------------------------------------
VBA FORM Variable "b'lblLastCheckted'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
-------------------------------------------------------------------------------
VBA FORM Variable "b'lblVersionNumber'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
-------------------------------------------------------------------------------
VBA FORM Variable "b'lblNewIsHere'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
-------------------------------------------------------------------------------
VBA FORM Variable "b'StartUpdateButton'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
-------------------------------------------------------------------------------
VBA FORM Variable "b'RemindMeButton'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
-------------------------------------------------------------------------------
VBA FORM Variable "b'ComboBox1'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
b''
-------------------------------------------------------------------------------
VBA FORM Variable "b'lblNotNow'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
-------------------------------------------------------------------------------
VBA FORM Variable "b'lblDownloadNow'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
-------------------------------------------------------------------------------
VBA FORM Variable "b'lblWhatsNew'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
None
-------------------------------------------------------------------------------
VBA FORM Variable "b'txtWhatsNew'" IN 'VbaProject.OTM' - OLE stream: 'OutlookVbaData/frmUpdate'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
b''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment