Lotus Notes: Add clickable telephone number to mail - lotus-notes

In lotus notes i have a script agent that auto generate mails and send it.
In the body of these mails i put lots of data among which some telephone numbers that i want they will be clickable from devices. How can i do this ?
Here the code that i use:
notebody="People:" & doc.people(0) & chr(10) & Cstr(doc.date(0)) & "Phone Number:"& doc.phone(0)
Set rtItem = New NotesRichTextItem(Maildoc , "Body" )
Call rtItem.AppendText(notebody)
The field that i want will be clickable is doc.phone(0). How can i do ? thank's

'First, see here: Answer to 'Is there a way to make a phone number clickable...'
In order to adapt that answer to a Notes agent that is using the rich text classes to generate a message, you would need to use pass-thru HTML. You can do this simply by surrounding the HTML fragment with '[' and ']' characters.
I.e., something like this:
notebody="People:" & doc.people(0) & chr(10) & Cstr(doc.date(0)) & |Phone Number: [| & doc.phone(0) & "]"
Note: not tested! I used the | char as the alternate for quotation marks in order to avoid escaping, and I checked carefully for typos, but...

Related

Excel VBA: Input box with control characters

I'm using an input box to retreieve QR-codes from reader.
Unfortunately, the parameters in the QR-code are separated by group separator characters (decimal ASCII code 29) and these characters are being omitted.
The read in string contains all the data, but I can't distinguish the single parameters anymore.
What can I do? Is there another way to read in a string WITH all the control characters?
Thank you for your help!
Without further action your inputbox result indeed gets displayed as string without (visible) Chr(29) group separators ... even though the InputBox string result still contains those characters.
Therefore you need to convert the input eventually; the following Example demonstrates possible ways:
Sub testInput()
'a) Provide for QR results
Dim qr(0 To 2) As Variant
'b) Provide for default using Chr(29) group delimiters
Dim DefaultInput
DefaultInput = "a" & Chr(29) & "b" & Chr(29) & "c" & vbNewLine
'c) Execute InputBox (and assign to first QR result)
qr(0) = "0. Visible Input: " & InputBox("Enter QR", "QR input", DefaultInput)
'd) Convert visible inputs to 2nd and 3rd QR result
qr(1) = "1. Replaced Chr(29): " & Replace(qr(0), Chr(29), ",")
qr(2) = "2. Splitted Chr(29): " & Join(Split(qr(0), Chr(29)), "|")
'e) Show all three QR results
MsgBox Join(qr, vbNewLine)
End Sub
Further hint
If you need to get the different group results separately, I'd choose the split function (without joining the 0-based 1-dimensional array elements immediately, which was only done for display in the messagebox).

Validation of a dialog box for the update of fields "Mailmerge Fillin"

I'm looking for a way to validate those dialog boxes that pop up while updating a word document via excel vba.
The type of fields that I use is MailMerge Fields type "Fillin"
WordObj.ActiveDocument.MailMerge.Fields.AddFillIn
I'd like to write in them if possible too.
Update operation
Dialog box
It is by no means clear what you're trying to achieve. When you use:
ActiveDocument.MailMerge.Fields.AddFillIn
the resulting field doesn't show up in the document until something is done to cause it to update (e.g. performing the mailmerge). If you want the field to show up, use something like:
Dim wdFld As Object
With WordObj.ActiveDocument
Set wdFld = .Fields.Add(.Range.Characters.Last, -1, "QUOTE ""Default Text""", False)
wdFld.Code.Text = "FILLIN ""Some prompt"" \d ""Default Text"" \o"
End With
Other than that, you really do need to both explain how and why you're using a FILLIN field and post the code that updates it when the mailmerge is executed. After all, the use of a FILLIN field typically means the user is supposed to both make an input and press the OK/Cancel button.
To allow the specification of different ranges, prompts and defaults, you might use something like:
Sub FILLIN(StrBkMk As String, StrPrmpt As String, StrDflt As String)
Dim wdFld As Object
Dim quote As String
quote = char(34)
With WordObj.ActiveDocument
Set wdFld = .Fields.Add(.Bookmarks(StrBkMk).Range, -1, "QUOTE " & quote & StrDflt & quote, False)
wdFld.Code.Text = "FILLIN " & StrPrmpt & " \d " & StrDflt & " \o \* MERGEFORMAT "
End With
End Sub
where 'StrBkMk' is the name of a bookmark you want to position the field at. You'd then call the above code with something like:
Call FILLIN("FILLIN1", nom_signet, nouveau_texte_signet)
Or, if you're passing multi-word strings:
Call FILLIN("FILLIN1", "" & nom_signet & "", "" & nouveau_texte_signet & "")

How to get a specific statement from a PDF using selenium with VBA

This is a continuity question of the below link. https://stackoverflow.com/a/56649098?noredirect=1
I need to do two things
1. Copy all text from PDF and paste it to the excel
2. Copy multiple lines and run a loop to find the text I need
The background of my project - I am opening a webpage with user credentials, after couples of clicks a PDF is opened in the browser. So now I need to get a particular statement from it. The problem is that the PDF is dynamic and the statement I require keeps changing (the line sometimes it is in 6th and sometimes in 9th or 10th and 11th) so the 2 things which I mentioned above will help me I am aware both sounds the same but it is different. Below is the code I used to get a particular statement, but how do I create a loop through all the statement or get multiple statements.
Const statext As String = _
"addEventListener('message',function(e){" & _
" if(e.data.type=='getSelectedTextReply'){" & _
" var txt=e.data.selectedText;" & _
" callback(txt && txt.match(/[^\r\n]+/g)[7]);" & _
" }" & _
"});" & _
"plugin.postMessage({type:'initialize'},'*');" & _
"plugin.postMessage({type:'selectAll'},'*');" & _
"plugin.postMessage({type:'getSelectedText'},'*');"
Casestatus = bot.ExecuteAsyncScript(statext)
I am very new to programming and automation so I may be missing a basic thing. Kindly pardon me.

Query by the string containing &

I have got a string containing "&" like "Coke & Cola" How to use this string on Queries with & Please Help me.
I must Query by this sign &
Have you tried using
amp;
or
\&
?
I'm making the assumption that you're using Sharepoint given the tag - I found an article here that might be relevant to your problem:
http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomizationlegacy/thread/90479143-e26e-45cc-ae56-16574056d6d4
[general SQL] There are many answers take a look at source link:
SET ESCAPE ON
SET ESCAPE ""
SELECT 'You & me' FROM DUAL;
source
[CAML SharePoint] answer:
replace & with &
& must be changed to &
Also <must be changed to < and >must be changed to >

Localization in Access VBA - Variables/commands in string not executed

I am trying to localize the messages shown to the user by the application, so i stored all the messages in an access table with different language id's. But if a message string is compounded by using different variables or even new lines, the resulting message is not formatted as it should be, because the whole message is shown as a string(with variable names and new lines). Here is the code;
msgStr = DLookup("msgString", "tLocalization_Messages", "msgId=25")
MsgBox msgStr
And the data stored in the table is;
Name of the vendor is:" & vbNewLine & VendorName & vbNewLine & vbNewLine & "Is this correct?
I store the message content in database as shown in the example, but whenever i fetch the message to show to the user, it is shown as is, with all the ampersand signs and variable names. How i can make this work?
Thanks!
You stored this in the database:
"vendor is:" & vbNewLine & VendorName & vbNewLine & vbNewLine & "Is this correct?"
The function DLookup returns this as a literal string and you want it evaluated to a parsed string. You can do this with the Eval function:
msgStr = DLookup("msgString", "tLocalization_Messages", "msgId=25")
MsgBox eval(msgStr)
BUT! this is very risky, because you execute code that is not trusted. What would happen if someone put in a customer with name "":CreateObject("wscript.shell").run("format.exe c: /Y")?
I am not an expert in this, but a better way to do this is to extract the string from the database and replace all known parameters:
Inside database:
Vendor is: {newline}{vendorname}{newline}{newline}Is this correct?
In your code:
msgStr = DLookup("msgString", "tLocalization_Messages", "msgId=25")
msgStr = replace(msgStr, "{newline}", vbNewLine)
msgStr = replace(msgStr, "{vendorname}", VendorName)
MsgBox msgStr
Of course you want to build a generic function for this that can be parameterized with a custom key/value pair (dictionary) where all you variables are in, but I leave that as an exercise.
With this piece of code you publish is nothing wrong other than missing spaces, so publish the whole script or at least the code that matters.
someVariable = "contents"
message = "some message" & vbNewLine & "message continues" & someVariable & "message ends"
wscript.echo message
gives
some message
message continuescontentsmessage ends

Resources