PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Determining current cursor position in inspector item
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
Determining current cursor position in inspector item
![]() |
Determining current cursor position in inspector item |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 > > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

