Import OpenOffice Calc file to a form

detrie

Registered User.
Local time
Today, 06:44
Joined
Feb 9, 2006
Messages
113
I am trying to import an OpenOffice Calc spreadsheet into an MS Access Form

The code below works with an MSWord Form I've created.

I could use some help converting this to work with .ods files

Code:
Dim appWord As Object
Dim doc As Object
Dim strDocName As String
Dim blnQuitWord As Boolean
Dim strFile As String


On Error GoTo ErrorHandling

    strFile = Me.ctlDropBox 

    If IsNull(strFile) Then
    If MsgBox("FIRST drag the file into the green box" & vbCr & _
    "THEN click the import button" & vbCr & vbCr & _
    "The import will now Cancel", vbQuestion + vbYes, "Oops! Nothing to Import ") = vbYes Then
Exit Sub
End If
    Else
        If MsgBox("Are you sure you want to process this PC Request Form? ", vbQuestion + vbYesNo, "Import PC Request Form") = vbNo Then
Exit Sub
    Else
    End If
        End If

DoCmd.GoToRecord , , acNewRec
Me.Status = 9

Set appWord = GetObject(, "Word.Application")
Set doc = appWord.Documents.Open(strFile)

    ' I know I will need to remap these to the Calc file.
    Me.cmbBrand = doc.FormFields("fld_0").Result
    Me.tblCustomerName = doc.FormFields("fld_1").Result
    Me.tblOpportunityOwner = doc.FormFields("fld_12").Result

doc.Close
If blnQuitWord Then appWord.Quit
 

Users who are viewing this thread

Back
Top Bottom