0

I have created the form template in excel. now I want to replicate the same in InfoPath.like I have created a table in excel and I want the table to import in InfoPath form.

How to import selected excel table or cell into InfoPath form ?

Thanks In Advance.

  • Should you clarify your scenario in more details at the above Quest body ? – Mohamed El-Qassas MVP Jul 14 '16 at 7:51
  • I have created the form template in excel. now I want to replicate the same in infopath.like I have created a table in excel and i want the table to import in infopath form. How to do it – Lakshmi Jul 14 '16 at 8:01
1

Your question is not clear and hard to understand. I'm not sure you are using InfoPath in the way it was intended.

InfoPath is a tool to display XML data in a visually appealing way. There is no immediate connection between InfoPath forms and Excel tables.

InfoPath forms can be filled in and stored in a database or in a SharePoint library. The stored data is just the XML. If the record is opened with InfoPath filler, the form shows as designed with InfoPath Designer.

If you have an Excel spreadsheet and a VBA User Form to enter data, that Excel form can NOT be transformed into an InfoPath form automatically. InfoPath is totally separate from Excel and operates in a completely different universe.

I work with both InfoPath and Excel on a daily basis. If there was an easy way to translate an Excel form into InfoPath, I'm sure I'd like to know about it, but AFAIK it does not exist.

0

I am working on this issue at the moment myself. I have rows of data in Excel that I want to transfer to 'fields' on an existing InfoPath form. I haven't tested this yet but this is the direction I am heading in and I hope it helps. I have Microsoft XML v6.0 and Microsoft Office InfoPath 3.0 Type library in then VBE Tools/References, and have no compiling issues.

Sub writeToInfoPath()
'
Dim objIP As InfoPath.Application
Dim objDoc As MSXML2.DOMDocument
Dim objNode As MSXML2.IXMLDOMNode

    Set objIP = New InfoPath.Application
    Set objDoc = New MSXML2.DOMDocument

    With Application.FileDialog(msoFileDialogOpen)
        .ButtonName = "&Open"
        .InitialFileName = strFormPath 'private const declared elsewhere
        .Filters.Clear
        .Filters.Add "XML Files (*.XML)", "*.XML", 1
        .Title = "File Open"
        .AllowMultiSelect = False
        If .Show = -1 Then
            Set objDoc = objIP.XDocuments.Open(.SelectedItems)
            'process cancelled
            If objDoc Is Nothing Then
                GoTo exitPROC
            End If
        End If
    End With

    'the cells based on node name in infopath...
    'BDA Name
    objDoc.SelectSingleNode("//my:BDA_Info/my:BDA_Name").Text = ActiveCell.Value
    'BAT ref
    objDoc.SelectSingleNode("//my:BDA_Info/my:BAT_Number").Text = ActiveCell.Offset(0, 1).Value
    'Business Contact User Id
    objDoc.SelectSingleNode("//my:BDA_Info/my:BDA_Contact_UserID").Text = ActiveCell.Offset(0, 2).Value
    'Date Released
    objDoc.SelectSingleNode("//my:BDA_Info/my:BDA_Dt_Release").Text = ActiveCell.Offset(0, 3).Value
    'Business contact
    objDoc.SelectSingleNode("//my:BDA_Info/my:BDA_Contact_FullName").Text = ActiveCell.Offset(0, 4).Value
    'Business contact phone #
    objDoc.SelectSingleNode("//my:BDA_Info/my:BDA_Contact_Phone").Text = ActiveCell.Offset(0, 5).Value

exitPROC:

End Sub

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.