A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Solution: how to attach a Lotus Notes Doclink to an Outlook message



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old July 6th 06, 04:28 PM posted to microsoft.public.outlook.program_vba
callmedoug
external usenet poster
 
Posts: 13
Default Solution: how to attach a Lotus Notes Doclink to an Outlook message

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  
Old July 7th 06, 06:49 AM posted to microsoft.public.outlook.program_vba
Michael Bauer
external usenet poster
 
Posts: 435
Default Solution: how to attach a Lotus Notes Doclink to an Outlook message

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
Search this Thread:

Advanced Search
Display Modes

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
Forum Jump

Similar Threads
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


All times are GMT +1. The time now is 08:52 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.