1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| Public Sub modifxml()
Dim strSQL As String
Dim xlApp As Excel.Application
Dim lafacture As Long
On Error GoTo erreurhand
lafacture = InputBox("Le numéro de la facture")
'Update a 0 AccountinginterfaceInd permet de toucher à la facture
strSQL = "UPDATE dbo_tblInvoice SET dbo_tblInvoice.AccountingInterfaceInd"
strSQL = strSQL & " =0"
strSQL = strSQL & " WHERE dbo_tblInvoice.InvoiceNo=%1 "
strSQL = Replace(strSQL, "%1", lafacture)
'Debug.Print strSQL
CurrentDb.Execute (strSQL)
'on ouvre Excel
Set xlApp = New Excel.Application
With xlApp
.AddIns("MEGAInvoicing").Installed = False '<=========
.AddIns("MEGAInvoicing").Installed = True '<========= Ceci est le fameux AddIns qui ne s'affiche plus
.Workbooks.Open ("M:\Document\facture\CreateXML.xlsm")
.Range("J2").Value = lafacture
.Visible = True
.Application.Run "createXML" ' la macro de mon fichier excel
.Workbooks(1).Close (False)
.Quit
End With
Set xlApp = Nothing
Exit Sub
erreurhand:
MsgBox "Hahaha, il y a une erreur", vbCritical
Set xlApp = Nothing
End Sub |
Partager