![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I meant to submit this a while back, oh well better late than never.
Anyway, when our company moved from Lotus Notes to Outlook, we needed a way to still attach links to out database documents within the outlook messages. The following code does that very thing. basically it takes teh .ndl from your clipboard coverts it into a .txt file on your system, attaches it to your email, then deletes itself. I hope others can find value in this also. regards Doug ==== start code===== Public Sub DocLink() '--------------------------------------------------------------------------------------------------- ' The DocLink macro was written by: ' Douglas Portz ' MTS Allstream ' ' This macro replicates the "doclink" function in Lotus Notes and allows for Notes Doclinks to be ' attached in outlook ' ' To use this macro, you would create a doclink in notes, and then run this macro in outlook to 'attach the link (actually attach macro to email (word macro) and build a button within the email 'for convienece.) ' ' This macro requires the following additional library references to be active ' - Microsoft Outlook 11.0 Object Library ' - Microsoft Forms 2.0 Object Library (auto added when a form is added - delete form afterwards) '---------------------------------------------------------------------------------------------------- ' Stores the filename for the doclink Dim strFileName As String ' create a clipboard item Dim MyDataObj As New DataObject ' clipboard text item Dim MyDocLink As Variant ' DocLink file and path Dim MyLinkPath As String 'boolean check used for file name errors Dim IsFileCreated As Boolean 'new file not yet created, no "kill" required IsFileCreated = False On Error GoTo ErrHdl 'copy the clipboard to dataobject MyDataObj.GetFromClipboard MyDocLink = MyDataObj.GetText 'Set file name as the first line of the DocLink Dim x As Variant x = Split(MyDocLink, Chr(10)) strFileName = Left(x(0), Len(x(0)) - 1) ' Open the file for exporting the link. ' file created in the Root Folder MyLinkPath = "c:\" & strFileName & ".ndl" TryAgain: Open MyLinkPath For Output As #1 ' file has been written to root, tag for deletion after attached IsFileCreated = True 'check to ensure clipboard has something in it If MyDocLink = "" Then GoTo ErrHdl End If ' check to see if this is a NDL link If Left(x(1), 5) "NDL" Then GoTo ErrHdl Else Print #1, MyDocLink End If 'close the ndl file Close #1 'add attached doclink Set EmailMessage = Outlook.ActiveInspector.CurrentItem With EmailMessage .Attachments.Add (MyLinkPath) End With 'delete the DocLink file from the hardrive Kill (MyLinkPath) Exit Sub 'Error Handling, if the file is not formated correctly notify user and delete ErrHdl: Close #1 'if file was already created then remove it from harddrive If IsFileCreated = True Then Kill (MyLinkPath) Else ' error may be because of the file name, use default and try again MyLinkPath = "C:\DocLink.ndl" GoTo TryAgain End If 'Houston we have a problem - tell user the link can't be created MsgBox "This does not appear to be a valid doclink", vbOKOnly, "Error" End Sub ====end code==== |
Ads |
#2
|
|||
|
|||
![]()
Am 6 Jul 2006 07:28:10 -0700 schrieb callmedoug:
Thanks, Doug. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook -- www.VBOffice.net -- I meant to submit this a while back, oh well better late than never. Anyway, when our company moved from Lotus Notes to Outlook, we needed a way to still attach links to out database documents within the outlook messages. The following code does that very thing. basically it takes teh .ndl from your clipboard coverts it into a .txt file on your system, attaches it to your email, then deletes itself. I hope others can find value in this also. regards Doug ==== start code===== Public Sub DocLink() '--------------------------------------------------------------------------------------------------- ' The DocLink macro was written by: ' Douglas Portz ' MTS Allstream ' ' This macro replicates the "doclink" function in Lotus Notes and allows for Notes Doclinks to be ' attached in outlook ' ' To use this macro, you would create a doclink in notes, and then run this macro in outlook to 'attach the link (actually attach macro to email (word macro) and build a button within the email 'for convienece.) ' ' This macro requires the following additional library references to be active ' - Microsoft Outlook 11.0 Object Library ' - Microsoft Forms 2.0 Object Library (auto added when a form is added - delete form afterwards) '---------------------------------------------------------------------------------------------------- ' Stores the filename for the doclink Dim strFileName As String ' create a clipboard item Dim MyDataObj As New DataObject ' clipboard text item Dim MyDocLink As Variant ' DocLink file and path Dim MyLinkPath As String 'boolean check used for file name errors Dim IsFileCreated As Boolean 'new file not yet created, no "kill" required IsFileCreated = False On Error GoTo ErrHdl 'copy the clipboard to dataobject MyDataObj.GetFromClipboard MyDocLink = MyDataObj.GetText 'Set file name as the first line of the DocLink Dim x As Variant x = Split(MyDocLink, Chr(10)) strFileName = Left(x(0), Len(x(0)) - 1) ' Open the file for exporting the link. ' file created in the Root Folder MyLinkPath = "c:\" & strFileName & ".ndl" TryAgain: Open MyLinkPath For Output As #1 ' file has been written to root, tag for deletion after attached IsFileCreated = True 'check to ensure clipboard has something in it If MyDocLink = "" Then GoTo ErrHdl End If ' check to see if this is a NDL link If Left(x(1), 5) "NDL" Then GoTo ErrHdl Else Print #1, MyDocLink End If 'close the ndl file Close #1 'add attached doclink Set EmailMessage = Outlook.ActiveInspector.CurrentItem With EmailMessage .Attachments.Add (MyLinkPath) End With 'delete the DocLink file from the hardrive Kill (MyLinkPath) Exit Sub 'Error Handling, if the file is not formated correctly notify user and delete ErrHdl: Close #1 'if file was already created then remove it from harddrive If IsFileCreated = True Then Kill (MyLinkPath) Else ' error may be because of the file name, use default and try again MyLinkPath = "C:\DocLink.ndl" GoTo TryAgain End If 'Houston we have a problem - tell user the link can't be created MsgBox "This does not appear to be a valid doclink", vbOKOnly, "Error" End Sub ====end code==== |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook Live and Lotus Notes | Bigsky | Outlook - Installation | 0 | June 1st 06 06:18 PM |
How do I save notes on a v-card that I attach in Outlook? | Laurie Hodges | Outlook - Using Contacts | 2 | April 18th 06 07:37 PM |
Lotus notes to outlook | max_mont | Outlook - General Queries | 1 | April 9th 06 04:50 PM |
Outlook + Lotus Notes Connector | Bryan | Outlook - Calandaring | 3 | March 28th 06 03:14 PM |
lotus notes 6.5.4 outlook connector | mars211 | Outlook - Installation | 0 | March 3rd 06 03:18 PM |