Add selected texts from Listbox to the message body where cursor is placed

jonnathanjons
Lounger
Posts: 37
Joined: 13 Apr 2023, 09:08

Add selected texts from Listbox to the message body where cursor is placed

Post by jonnathanjons »

Hello ,

I have posted this in another forum but could not get a reply and hence posting it here..
I have a text file where I keep updating urls for easy access as I am focal for many geos. When I get queries I reply by posting relevant urls for them. I will be great If I can achieve this by running a macro which can paste the url in the message body where I position the cursor in the message body while draft an email.

I have partially achieved this by creating a Listbox as suggested in another forum but it only paste the url in the subject area which is not useful to me.
I even tried to tweak the script but its pasting only at the topline of the message body which is again not useful to me.

If I can get a script which can achieve this it will be really appreciated.

https://forums.slipstick.com/threads/99 ... is-placed/
the code I used is in this link https://www.slipstick.com/developer/cod ... file-list/
but it paste the url only to the subject field . I would like to have them pasted in the message body where I draft the email ie where I position my cursor.

User avatar
HansV
Administrator
Posts: 78467
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Add selected texts from Listbox to the message body where cursor is placed

Post by HansV »

Use code like this:

Code: Select all

    ActiveInspector.WordEditor.Application.Selection.InsertAfter lstText
Best wishes,
Hans

jonnathanjons
Lounger
Posts: 37
Joined: 13 Apr 2023, 09:08

Re: Add selected texts from Listbox to the message body where cursor is placed

Post by jonnathanjons »

Hello HansV. You are a genius .solved the issue in a single line..love ya..thanks a lot