MS Outlook - Change The Hyperlink Tooltip - hyperlink

Does anyone have an idea how I could change the displayed tooltip when a mouse hovers over a hyperlink in an email?

The screentip can be set with Word's Hyperlinks.Add method.
http://msdn.microsoft.com/en-us/library/office/ff837214%28v=office.15%29.aspx
expression .Add(Anchor, Address, SubAddress, ScreenTip, TextToDisplay, Target)
This describes how you use Hyperlinks.Add in Outlook.
http://msdn.microsoft.com/en-us/library/dd492012%28v=office.12%29.aspx
strLink = "http://www.outlookcode.com"
strLinkText = "Get Outlook code samples here"
Set objInsp = objMsg.GetInspector
If objInsp.EditorType = olEditorWord Then ' <===
Set objDoc = objInsp.WordEditor
Set objSel = objDoc.Windows(1).Selection
If objMsg.BodyFormat <> olFormatPlain Then
objDoc.Hyperlinks.Add objSel.Range, strLink, _
"", "", strLinkText, ""
Else
objSel.InsertAfter strLink
End If
End If

Related

Sending emails to recipients if certain cell value is met by each receipient

Basically I've used Google Sheets to create an invoice tracker, and I want to send a reminder email to each of my clients when their invoice is due. I've already set the date and the count down, and now I want to send them the reminder email when the cell value reaches "2" meaning 32 days has passed since I've invoiced them.
I've gathered the codes from different sources online, and also I've set a 24 hr trigger to run the code once in a day. The email template is also in place. Data of each client (dates, names, addresses, etc.) are listed in separate rows.
My problem is that instead of sending 1 single email to the right client, the mailing app sends emails to all clients when any of them have a due invoice!
I'm not sure which function or code I should use.
I tried 'Email_Sent' thing, but couldn't get anywhere good with it!
function CheckMaturity() {
// Fetch invoice maturity
SpreadsheetApp.getActiveSpreadsheet().getSheetByName('InvoiceTracker').activate();
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
for (var i = 5;i<=10;i++){
var invoiceMaturityRange = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('InvoiceTracker').getRange(i, 13);
var invoiceMaturity = invoiceMaturityRange.getValue();
// Check invoice maturity
if (invoiceMaturity = 2){
// Fetch the email address
SpreadsheetApp.getActiveSpreadsheet().getSheetByName('InvoiceTracker').activate();
var templateText = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('EmailTemplate').getRange(1,1).getValue();
var currentAddress = ss.getRange(i, 15).getValue();
var currentInvoiceNo = ss.getRange(i, 3).getValue();
var currentInvoiceDate = ss.getRange(i, 4).getValue();
var currentClient = ss.getRange(i, 14).getValue();
var messageBody = templateText.replace('{client}',currentClient).replace('{invoiceNo}',currentInvoiceNo).replace('{invoiceDate}', currentInvoiceDate);
var subjectLine = 'Kind reminder - Invoice status';
MailApp.sendEmail(currentAddress, subjectLine, messageBody);{
SpreadsheetApp.getActiveSpreadsheet().toast('Invoice reminder sent to' +currentClient, 'Reminder sent', -1);
}
}
}
}
I want the app to send only one single email to the right (relevant) client.
I think you need the below. Please check the variables and references. The following code should be adjusted. The column 'A' should be replaced with the column in which you have the last record to prevent that you miss any clients. Furthermore, please check the comments in the code below.
.Range("A1047854").End(xlUp).Row
And hereby the full code:
Sub SendEmails()
Dim myOlApp As Outlook.Application, MailItem As Outlook.MailItem
Dim attachmentPath1 As String, attachmentPath2 As String
Set myOlApp = CreateObject("Outlook.Application")
'loop through a sheet (change index)
For i = 1 To ThisWorkbook.Sheets("index").Range("A1047854").End(xlUp).Row
'set key for check (or just do it directly in the if)
invoiceMaturity = ThisWorkbook.Sheets("index").Range("A" & i).Value
If invoiceMaturity = "2" Then
'you can load the variables first, before adding them to the email, or add them directly.
Name = ""
MailAddress = ""
Address = ""
currentInvoiceNo = ""
currentInvoiceDate = ""
currentClient = ""
'make item for each iteration (again)
Set MailItem = myOlApp.CreateItem(olMailItem)
'attachments
attachmentPath1 = "path/to/file.something" 'or set to ""(nothing)
'body
MailItem.HTMLBody = "<B>" & "<h3>" & "DRAFT:" & "</h3>" & "</B>" & "<br>" & _
"Dear, " & "<br>" & "<br>" & _
"Please find enclosed a kind reminder.." & "<br>" & "<br>" & _
"Please note, that.." & "</b>" & "<br>" & "<br>" & _
"Should you have any questions or comments on the above, please do let us know." & "<br>" & "<br>" & _
"Kind regards," & "<br>" & "<br>" & _
"Signature"
MailItem.to = MailAddress 'adjust email
MailItem.Subject = "[subject of email" & "a variable?" 'adjust subject
MailItem.Show 'or mailitem.send
'just to make sure
Set MailItem = ""
End If
Next i
End Sub

Create a plain text message with Exchange 2013

I am trying to send a plain text message every time I create a message it changes to HTML format.
I am using PowerShell v5 with CDO 1.2.1 with Redemption v5.19 and connecting to Exchange 2013.
I am creating an IPM.Note and setting the bodyformat to 1 (plain text), however as soon as I add any text to the body the bodyformat value changes to 2 (HTML). Once bodyformat is set to 2 I cannot change the value back.
$rs = New-Object -ComObject "Redemption.RDOSession"
$rsOutbox = $rs.GetDefaultFolder(4)
$msg = $rsOutbox.items.add("IPM.Note")
$msg.BodyFormat = 1
$msg.body = "Test"
You can try to set the RTFBody instead to a string that explicitly specifies plain text body:
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set folder = Session.GetDefaultFolder(4)
set Msg = folder.Items.Add
Msg.To = "user#example.com.com"
Msg.Subject = "testing body format"
Msg.RTFBody = "{\rtf1\ansi\ansicpg1252\fromtext \fbidis \deff0{\fonttbl " & _
"{\f0\fswiss Arial;}" & _
"{\f1\fmodern Courier New;}" & _
"{\f2\fnil\fcharset2 Symbol;}" & _
"{\f3\fmodern\fcharset0 Courier New;}}" & _
"{\colortbl\red0\green0\blue0;\red0\green0\blue255;}" & _
"\uc1\pard\plain\deftab360 \f0\fs20 Test \par" & _
"}"
Msg.BodyFormat = 1
Msg.Save

VB6 - How could I get the ListBox selected id

AS I using the VB6.0 for create a Dialog Box with the ListBox, but only I can get the String text with Trim(DlgText$("xxxxx")), for the other side still I could not found how to get it.
Most of the answer from network said that could be using [LisBox_ID].Selected to get the item that what they want, but I can not get the same result.
For my Code:
[Dialog]
Function aOpenDialog As Boolean
aOpenDialog = False
iArrayLoop = 0
Begin Dialog UserDialog ,,250,120,ScriptTitle,.ActivateDlgControls
Text 5,5,130,10,"Sub Booking End Date", .tf_InsertionSetEndDate
ListBox 5,15,100,100,aArrayList, .aArrayList
Text 110,5,130,10,"After Date [DD-MMM-YYYY]", .tf_AfterDate
TextBox 110,15,55,10, .txt_AfterDate
Text 110,25,55,10,"Change Reason", .tf_ChangeReason
TextBox 110,35,130,10, .txt_ChangeReason
OKButton 110,45,70,10, .btn_Save
CancelButton 110,55,70,10, .btn_Cancel
End Dialog
Dim dlg As UserDialog
aArrayList(1) = "Day1"
aArrayList(2) = "Day2"
Dialog dlg
End Function
[ActiveDlgControls]
Function ActivateDlgControls(ControlName$, Action%, SuppValue%)
If (Action% = 2 And ControlName$ = "btn_Save") Then
sMissingMessage = ""
If (Not IsDate(CStr(Trim(DlgText$("txt_AfterDate"))))) Then
sMissingMessage = sMissingMessage & "- Please input the correct day format"
Else
MsgBox Format(Trim(DlgText$("txt_AfterDate")), "dd mmm yyyy")
' This Area will be using for get the selected array item id
' I can found the selected items with String
MsgBox Trim(DlgText$("aArrayList"))
' Unknow way to found the selected items id
' MsgBox dlg.aArrayList.SelectedItem(x)
End If
If (sMissingMessage <> "") Then
ActivateDlgControls = 1
iCheckResult = 1
sMissingMessage = "Information Missing:" & sMissingMessage
MsgBox sMissingMessage
End If
ElseIf (Action% = 2 And ControlName$ = "btn_Cancel") Then
iCheckResult = 2
End If
End Function
Any idea how should I get the selected ListBox item?
I want to get the array number that I selected inside the LisBox.
Although I got an other stupid idea for get the index like as below code:
For iArrayLoopCheck = 0 To UBound(aArrayList)
If (aArrayList(iArrayLoopCheck) = Trim(DlgText$("aArrayList")))Then
MsgBox "You Select item: " & iArrayLoopCheck
Exit For
End If
Next
Still I was looking for any smart code/ items/ easy way to get the result quickly just like get the String value in array like: Trim(DlgText$("xxxxx"))
Best Regards,
KT
To get the selected index of the list box:
list.ListIndex
returns 0 if the first item is selected, 1 if the second item is selected, etc., and -1 if no item is selected.

Macro to find paragraphs in text selection in Open/Libre/Neo Office

I am trying to enumerate the paragraphs selected by the user in (Neo|Libre|Open)Office.
When I use the code below, modified version from here,
Sub CheckForSelection
Dim oDoc as Object
Dim oText
oDoc = ThisComponent
oText = oDoc.Text
if not IsAnythingSelected(oDoc) then
msgbox("No text selected!")
Exit Sub
end if
oSelections = oDoc.getCurrentSelection()
oSel = oSelections.getByIndex(0)
' Info box
'MsgBox oSel.getString(), 64, "Your Selection"
oPE = oSel.Text.createEnumeration()
nPars = 0
Do While oPE.hasMoreElements()
oPar = oPE.nextElement()
REM The returned paragraph will be a paragraph or a text table
If oPar.supportsService("com.sun.star.text.Paragraph") Then
nPars = nPars + 1
ElseIf oPar.supportsService("com.sun.star.text.TextTable") Then
nTables = nTables + 1
end if
Loop
' Info box
MsgBox "You selection has " & nPars & " paragraphs.", 64
end Sub
it finds ALL the paragraphs in the document, not just in the selection. Google has failed me. Any thoughts on how to find individual paragraphs in the selection?
The oSel.Text is a shortcut for oSel.getText() which "Returns the text interface in which the text position is contained." https://www.openoffice.org/api/docs/common/ref/com/sun/star/text/XTextRange.html#getText
So to get a ParagraphEnumeration only from the Selection, you should use oPE = oSel.createEnumeration() instead of oPE = oSel.Text.createEnumeration().

Clear text object from in Corona SDK

I have a search feature in Corona SDK that displays results from my website. The first run works perfect but the second search results lay over top the old results.
txt_mybest get repeated and inserted in to a scroll view. I can figure out how to remove the previous results.
If I remove the scroll group it becomes unusable
local function sumbitConnented( event )
if ( event.isError ) then
local alert = native.showAlert( "Connection Error", "Your information was not sent.
Please check your connection" , { "OK" }, onComplete )
else
nyHeight = 35
local t_ninja = json.decode( event.response )
for key in pairs(t_ninja) do
local xxteam_name = t_ninja[key]["team_name"]
nyHeight = nyHeight + 60
txt_mybest = display.newText("Team: "..xxteam_name,0,0,native.systemFont,13)
txt_mybest.anchorX = 0
txt_mybest.x = 85
txt_mybest.y = 38 +nyHeight
txt_mybest:setTextColor( 20/255, 20/255, 20/255 )
scroll:insert(txt_mybest)
end
function onSearchRelease()
sendInfo = {["findTeam"] = findTeam.text}
local headers = {
["Content-Type"] = "application/json",
["Accept-Language"] = "en-US",
}
local params = {}
params.headers = headers
params.body = json.encode( sendInfo )
network.request( "http://www.website.com/team-search.php?f=hw&u_device="..muserID, "POST", sumbitConnented, params )
end
Hopefully "Bohemian" has the mental ability to comprehend this question
you can use txt_mybest.text= "your new text" .. this will change text for your display.newText object as long as the object exsits.
You can add a display group in your scroll view and add all the text in it. When you want to remove the results, simply remove the group and add another one into scroll view. Like that you won't risk destroying your Scroll View and your results would clear off easily.

Resources