Obj.ExtractFile to a variable directory

I wanted to extract files from one Notes document and attach to another (email) document. To do this I use the code below. The problem was that some users were getting a security warning. The users were on a Terminal Server so my guess was a rights problem writing to the root c:. I have used the Windows variables %HomeDrive% %Homepath% in a OpenFileDialog, so I tried that but I received a warning about, “…not able to create the file…”.

Any Idea’s?

For now I have switched to code to point to the users Z drive (mapped private share).

Thanks

Sub AddAttachments(MailDoc As NotesDocument, SDoc As NotesDocument, RTItem As NotesRichTextItem)

' Need to check two fields for embeded objects and if present attach to email document.

Dim TempRTItem As NotesRichTextItem

Dim FileName() As String





If SDoc.HasEmbedded Then

	

	Set TempRTITem = SDoc.GetFirstItem("GSCSubPackage")

	If Not(Isempty(TempRTItem.EmbeddedObjects)) Then

		Forall Obj In TempRTItem.EmbeddedObjects

			Call Obj.ExtractFile("Z:\" + Obj.Source )

			Call RTItem.AddNewline(2)

			Call RTItem.EmbedObject(EMBED_ATTACHMENT, "", "Z:\" + Obj.Source)

			Kill "Z:\" + Obj.Source

		End Forall

	End If

	Set TempRTITem = SDoc.GetFirstItem("GSCRebar999")

	If Not(Isempty(TempRTItem.EmbeddedObjects)) Then

		Forall Obj In TempRTItem.EmbeddedObjects

			Call Obj.ExtractFile("Z:\" + Obj.Source )

			Call RTItem.AddNewline(2)

			Call RTItem.EmbedObject(EMBED_ATTACHMENT, "", "Z:\" + Obj.Source)

			Kill "Z:\" + Obj.Source

		End Forall

	End If

End If

End Sub