Attach file programmatically - InfoPath Dev
in

InfoPath Dev

Attach file programmatically

Last post 01-10-2008 04:05 AM by nukkumatti. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 01-07-2008 07:29 PM

    Attach file programmatically

    Hi,

    Can anyone tell me if it is possible to attach a file to a Infopath 2003 form programmatically, using VBScript.

    Thanks.

  • 01-08-2008 06:38 AM In reply to

    Re: Attach file programmatically

    This is possible.  Do you want it in the standard Attachment control or something else?

    Have you thought about just adding a hyperlink instead of embedding it in the form?

    You can point a file at the attachment control, I believe on MSDN it details what can be done witht he attachment control but I know you can set a file to it. It has been a year or so since I have done this.

  • 01-08-2008 04:48 PM In reply to

    Re: Attach file programmatically

    Thanks for the quick response.

    I cannot use a hyperlink as the form is emailed to different users for approval and final processing and these users do not have access to common share drives.

    What I am trying to do is under certain conditions, a .csv file is created on the users local drive and then attached to the form in a file attachment control (there is a reason that this data needs to be captured in a seperate .csv file and not on the form).  The user is then able to open this .csv file, input some required data and then send the form to a mail recipient.

    Using infopath 2003 and vbscript, I am able to programmatically create the file on the users local drive but I am not sure of the code required to attach it to the form.  Any help would be appreciated.

  • 01-08-2008 04:59 PM In reply to

    Re: Attach file programmatically

    Have you thought about creating an xml file instead of a CSV?  Then you could use it as a data source. 

    You can create ODBC connections to a CSV file.  I believe you could have each have an ODBC connection to the file you create and then load the data from the file via a secondary data connection.  That would pass the data from whatever is creating the data to your form.  I would create the data structure in your form and then import it in from the CSV. Then they update it in the form and it is delivered to the next one within the form.

  • 01-08-2008 06:07 PM In reply to

    Re: Attach file programmatically

    The reason for the csv file is that the user has some data in a format which can be pasted directly into excel (this is what the users are doing in their current process).  I tried creating a table in the infopath form which they could paste the data into but ran into problems with different numbers of rows.  If there is an easy way to paste data from excel into a table or control within the form, this would probably fix the problem. 

  • 01-09-2008 07:07 AM In reply to

    Re: Attach file programmatically

    Yah I think pasting directly into a table in InfoPath reliably would be difficult.

    I would explore importing the data via a secondary data source.  I had thought there was a custom control for Excel in InfoPath but I cannot find it in now.

  • 01-09-2008 04:18 PM In reply to

    Re: Attach file programmatically

    Thanks Clay,

    This file attachment is getting too hard (and I'm running out of time...) so I've decided to go for a repeating table which users can paste the data into.  What I need to do is allow for the correct number of rows before user pastes the data.  If the users enter the number of rows required, is there a way to insert that number of rows into the table using vbscript?

  • 01-09-2008 09:33 PM In reply to

    Re: Attach file programmatically

    It's ok. I've worked it out now.
  • 01-10-2008 04:05 AM In reply to

    Re: Attach file programmatically

    You could just add a Microsoft Ecxel Spredsheet Custom Control to your Infopath template.
    Listen to Motörhead cos they play Rock'n Roll :)
Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.