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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
Private Sub Ok_Click()
Chemin = DLookup("Chemin", "PARAMETRE")
CheminAcad = DLookup("CheminAcad", "PARAMETRE")
N°Affaire = Forms![Affaire]![N°Affaire]
NomAffaire = Forms![Affaire]![NomAffaire]
NomFichier = Forms![Affaire]![DOCUMENTS ESQ1].Form![NomFichier].Value
Utilisation = Forms![Affaire]![DOCUMENTS ESQ1].Form![Utilisation].Value
If Word.Value = True Then
Dim oApp As Object
Dim WordDoc As Word.Document
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
Set WordDoc = oApp.Documents.Add '-- crée un nouveau document word
Dim strDirPath As String
strDirPath = Chemin & "\" & N°Affaire & " - " & NomAffaire & "\" & "ESQ" & "\" & Utilisation & "\" & NomFichier
MsgBox strDirPath
WordDoc.SaveAs Chemin & "\" & N°Affaire & " - " & NomAffaire & "\" & "ESQ" & "\" & Utilisation & "\" & NomFichier '-- enregistre le nouveau doc
Word.Value = False
End If
If Excel_0.Value = True Then
Dim xlApp As Object
Dim Excel As Excel.Workbook
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set Excel = xlApp.Workbooks.Add '-- crée un nouveau document excel
'Only XL 97 supports UserControl Property
Excel.SaveAs Chemin & "\" & N°Affaire & " - " & NomAffaire & "\" & "ESQ" & "\" & Utilisation & "\" & NomFichier '-- enregistre le nouveau doc
On Error Resume Next
xlApp.UserControl = True
Excel_0.Value = False
End If
If Acad.Value = True Then
Dim stAppName As String
stAppName = CheminAcad
Call Shell(stAppName, 1)
NomFichier.SaveAs CheminAcad & "\" & N°Affaire & " - " & NomAffaire & "\" & "ESQ" & "\" & Utilisation '-- enregistre le nouveau doc
Acad.Value = False
End If
DoCmd.Close
Exit_Ok_Click:
Exit Sub
Err_Ok_Click:
MsgBox Err.Description
Resume Exit_Ok_Click
End Sub |
Partager