PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming Determining current cursor position in inspector item

Reply

Determining current cursor position in inspector item

 
Thread Tools Rate Thread
Old 25-09-2003, 11:57 AM   #1
Daniel Klann
Guest
 
Posts: n/a
Default Determining current cursor position in inspector item


Hi people,

I'm working with Outlook XP on Windows XP.

I've added some simple functionality to Outlook by allowing me to insert a
hyperlink to a folder or file into a message. I can browse to the file or
folder using the common dialog and BrowseForFolder API functions and the
hyperlink is added. Here is the procedure for inserting a folder
hyperlink:-

=======================================================================
Sub LinkToFolder()
Dim strHTML As String
Dim MItem As MailItem
Dim strTextToDisplay As String

strHTML = basBrowseForFolder.GetDirectory("Please Select Folder...")


If strHTML = "" Then Exit Sub
strHTML = Replace(strHTML, " ", "%20")
strHTML = "<A HREF=file://" & strHTML
strTextToDisplay = InputBox("What text do you wish to display?")
If strTextToDisplay = "" Then Exit Sub

strHTML = strHTML & ">" & strTextToDisplay & "</a>"

Set MItem = Application.ActiveInspector.CurrentItem

MItem.HTMLBody = strHTML & MItem.HTMLBody

End Sub

=======================================================================

The basBrowseForFolder is just the code from www.j-walk.com . Now, you can
see that
the hyperlink is inserted at the start of the active inspector's item, with
whatever text may already be in the message is appended after the hyperlink.

How can I insert the hyperlink whereever the cursor is in the message,
leaving text before and after the cursor undisturbed E.g. if I was replying
to a message and typed "The reports that you require can be found in this
folder" where the word 'this' would be the hyperlink to the folder in
question. This has had me
confused all afternoon and I'd love it if someone can shed some light.

Thanks for any help!

Daniel




  Reply With Quote
Old 27-09-2003, 01:08 AM   #2
Daniel Klann
Guest
 
Posts: n/a
Default Re: Determining current cursor position in inspector item

Thanks Sue. Using Word may be the way to go.

Regards,
Daniel


"Sue Mosher [MVP]" <suemvp@slipstick.com> wrote in message
news:eCpYCV2gDHA.696@TK2MSFTNGP09.phx.gbl...
If the user has Word as their editor, you can get the cursor position from
Word (ActiveInspector.WordEditor). Otherwise, Outlook provides no way to
determine the cursor position.

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
Microsoft Outlook Programming: Jumpstart
for Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Daniel Klann" <danielklann@hotmail.com> wrote in message
news:O2ZXeP1gDHA.2084@TK2MSFTNGP10.phx.gbl...
> Hi people,
>
> I'm working with Outlook XP on Windows XP.
>
> I've added some simple functionality to Outlook by allowing me to insert a
> hyperlink to a folder or file into a message. I can browse to the file or
> folder using the common dialog and BrowseForFolder API functions and the
> hyperlink is added. Here is the procedure for inserting a folder
> hyperlink:-
>
> =======================================================================
> Sub LinkToFolder()
> Dim strHTML As String
> Dim MItem As MailItem
> Dim strTextToDisplay As String
>
> strHTML = basBrowseForFolder.GetDirectory("Please Select Folder...")
>
>
> If strHTML = "" Then Exit Sub
> strHTML = Replace(strHTML, " ", "%20")
> strHTML = "<A HREF=file://" & strHTML
> strTextToDisplay = InputBox("What text do you wish to display?")
> If strTextToDisplay = "" Then Exit Sub
>
> strHTML = strHTML & ">" & strTextToDisplay & "</a>"
>
> Set MItem = Application.ActiveInspector.CurrentItem
>
> MItem.HTMLBody = strHTML & MItem.HTMLBody
>
> End Sub
>
> =======================================================================
>
> The basBrowseForFolder is just the code from www.j-walk.com . Now, you

can
> see that
> the hyperlink is inserted at the start of the active inspector's item,

with
> whatever text may already be in the message is appended after the

hyperlink.
>
> How can I insert the hyperlink whereever the cursor is in the message,
> leaving text before and after the cursor undisturbed E.g. if I was

replying
> to a message and typed "The reports that you require can be found in this
> folder" where the word 'this' would be the hyperlink to the folder in
> question. This has had me
> confused all afternoon and I'd love it if someone can shed some light.
>
> Thanks for any help!
>
> Daniel
>
>
>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off