Community articleExtractFile function
Added by IBM contributorIBM on August 15, 2011
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.


This function will extract an enclosure contained in a node and save it to a file on the local computer. Note that this function does not remove the enclosure from the form.


   Sub ExtractFile(
      theFile As String)


Table 1. Function parameters
theFileStringThe path showing where to store the file on the local drive. Any existing file will be overwritten.


Nothing if call is successful or throws an exception if an error occurs.


The following function extracts an attachment from a form and saves it to disk. First, the function uses DereferenceEx to locate the data item containing the attachment, then it uses ExtractFile to write the attachment to a file on the local drive.
   Sub SaveAttachment(Form)
      Dim TempNode  ' object
      Set TempNode = Form
      ' Locate the PAGE3.DATA1 item, which contains the enclosure.
      Set TempNode = TempNode.DereferenceEx(vbNullString, "PAGE3.DATA1", _
         0, UFL_ITEM_REFERENCE, Nothing)
      ' Extract the enclosure from the data item and save it to disk as
      ' c:\Review1.doc
      TempNode.ExtractFile "c:\Review1.doc"
   End Sub

Parent topic:
FormNodeP functions