A required argument has not been provided

Users are getthing the error “A required argument has not been provided” when they try to use the NDL button on any document that has been archived. This works great for any other document not archived. I cannot find anywhere in the script that would prohibit use of the button when a document is archived. Any suggestions? Thanks!

Option Public

Option Explicit

'Generate .NDL files for attachment to email messages, for benefit of non-Notes Mail users

'Contains two subs:

' * NDLdoclink

' * NDLComposeBody

'

'Based on script posted on DANGsite:

'	"Copyright 2004 DANGsite.com and pcorey.net  All rights reserved."

 '	"Please feel free to use the code, but at least give reference to me (DANGsite.com) for code source."

'The resulting file will have extension .NDL and body as follows:

'<NDL>

'<REPLICA 9999999:9999999>

'<VIEW 9999999:9999999-9999999:9999999>

'<NOTE 9999999:9999999-9999999:9999999>

'<HINT>CN=MyServer/O=MyOrg</HINT>

'<REM>Database 'My database', View 'My View', Document 'My document'</REM>

'</NDL>

'

NDLComposeBody subroutine

Private m_filenumb As Integer

Private m_filenum As Integer

Sub NDLdoclinkToDesktop(db As NotesDatabase, doc As NotesDocument, Byval filename As String, Byval label As String)

'Generates .NDL doclink file for current doc and saves it to user's Windows desktop

'Document must have been saved prior to running this sub.

'Database must have an App Profile with an entry for the Enterprise Directory

'User must have an entry in Enterprise Directory with a valid Device ID.  

'

	

Const openNDL = "<NDL>"

Const closeNDL = "</NDL>"

Const openHint = "<HINT>"

Const closeHint = "</HINT>"

Const leftopen = "<"

Const rightclose = ">"

Const openrem = "<REM>"

Const closerem = "</REM>"



Dim s As New NotesSession

Dim dbEDbook As NotesDatabase

Dim docEDbook As NotesDocument

Dim profDoc As NotesDocument

Dim v As NotesView

Dim strName As String

Dim strUserID As String

Dim fname As String

Dim path As String

Dim continue As Variant



'Retrieve the profile document and assign the Enterprise Directory assigned from profile document	

Set profDoc = db.GetProfileDocument("frmAppProfile")

Set dbEDbook = s.GetDatabase(profDoc.ap_EDserver(0), profDoc.ap_EDfilepath(0))

Set v = dbEDbook.GetView( profDoc.ap_EDEmployeeOnlyView(0) )



strName = s.CommonUserName



Set docEDbook = v.GetDocumentByKey( strName )

If docEDbook Is Nothing Then

	Messagebox "Unable to find desktop, so unable to create Notes Document Link at this time."

	continue = False

	Exit Sub

Else

	strUserID = docEDbook.DeviceID(0)

	path = "C:\Documents and Settings\" & strUserID & "\Desktop\"  'for NT	

	m_filenumb = 0

	m_filenum% = Freefile()

	fname = path & filename & "-" & m_filenumb

	Open fname & ".NDL" For Output As m_filenum%

	Print #m_filenum%, openNDL

	Print #m_filenum%, leftopen & "REPLICA " &  Mid$(db.ReplicaID, 1, 8) & ":" & Mid$(db.ReplicaID, 9, 8) & rightclose

	Print #m_filenum%, openHint & db.Server & closeHint

	'This is a document link

	Print #m_filenum%, leftopen & "NOTE OF" & Mid$(doc.UniversalID, 1, 8) & ":" & Mid$(doc.UniversalID, 9, 8) & "-ON" & Mid$(doc.UniversalID, 17, 8)  & ":" & Mid$(doc.UniversalID, 25, 8) & rightclose

	Print #m_filenum%, openrem & label & closerem

	Print #m_filenum%, closeNDL 

	Close m_filenum% 

	

	Messagebox filename & "-" & m_filenumb & ".NDL should now be on your desktop.  Attach it to the Service Desk entry needed, then delete."         

	

End If

End Sub

Sub NDLdoclinkToRoot(db As NotesDatabase, doc As NotesDocument, Byval filename As String, Byval label As String)

'Generates .NDL doclink file for current doc and saves it to user's root directory

'Document must have been saved prior to running this sub.

'Database must have an App Profile with an entry for the Enterprise Directory

'

'Versions:

' * 2004-09-20 	

'Construct the .NDL file on the user's c drive if Windows user or \home\notes\ if linux user

'Const path = "\home\notes\"  ' for linux-unix

Const path = "c:\"   'for NT



Const openNDL = "<NDL>"

Const closeNDL = "</NDL>"

Const openHint = "<HINT>"

Const closeHint = "</HINT>"

Const leftopen = "<"

Const rightclose = ">"

Const openrem = "<REM>"

Const closerem = "</REM>"



Dim fname As String



m_filenumb = 0

m_filenum% = Freefile()

fname = path & filename & m_filenumb

Messagebox fname	

Open fname & ".NDL" For Output As m_filenum%

Print #m_filenum%, openNDL

Print #m_filenum%, leftopen & "REPLICA " &  Mid$(db.ReplicaID, 1, 8) & ":" & Mid$(db.ReplicaID, 9, 8) & rightclose

Print #m_filenum%, openHint & db.Server & closeHint

	'This is a document link

Print #m_filenum%, leftopen & "NOTE OF" & Mid$(doc.UniversalID, 1, 8) & ":" & Mid$(doc.UniversalID, 9, 8) & "-ON" & Mid$(doc.UniversalID, 17, 8)  & ":" & Mid$(doc.UniversalID, 25, 8) & rightclose

Print #m_filenum%, openrem & label & closerem

Print #m_filenum%, closeNDL 

Close m_filenum% 	

End Sub

Sub NDLComposeBody(doc As NotesDocument, rtitem As NotesRichTextItem, bodytext As String, fname As String, label As String)

	'Composes the part of the Body field which has the links.

Call rtitem.AppendText( bodytext )

Call rtitem.AddNewline(2)

Call rtitem.AppendText("Link for Outlook Mail users:  --> ")

Call rtitem.EmbedObject( EMBED_ATTACHMENT, "",  fname & ".NDL" )

Call rtitem.AddNewline(2)

Call rtitem.AppendText("__________________________________________________________________")

Call rtitem.AddNewline(2)	

Call rtitem.AppendText("Link for Notes Mail users:  --> ")

Call rtitem.AppendDocLink( doc, label )

End Sub

Subject: What does the debugger tell you?

When you run the code with the debugger turned on, which line fails? That should help you figure out where to start fixing the code.