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
| 'Déclaration des variables
Dim appExcel As Excel.Application 'Application Excel
Dim wbExcel As Excel.Workbook 'Classeur Excel
Dim wsExcel As Excel.Worksheet 'Feuille Excel
Dim xlmacroBook As Excel.Workbook
Dim MavarXL
'Ouverture de l'application
Set appExcel = CreateObject("Excel.Application")
appExcel.Visible = True
'Ouverture d'un fichier Excel
Dim Presence As Boolean
Presence = False
fichier = "Outlook etiquette client.xls"
For Each w In Workbooks
If w.Name = fichier Then Presence = True
If w.Name = fichierratio Then appExcel.Workbooks("Ratio 2011.xls").Close
Next w
If Presence = True Then
Else
Set wbExcel = appExcel.Workbooks.Open("C:\Documents\Outlook etiquette client.xls")
End If
'wsExcel correspond à la première feuille du fichier
Set wsExcel = wbExcel.Worksheets(1)
Set myolapp = CreateObject("Outlook.Application")
Set myinspector = myolapp.ActiveInspector
With appExcel.Workbooks("Outlook etiquette client.xls").Sheets("Feuil1")
'On Error Resume Next
'.Application.ScreenUpdating = False
'.Application.DisplayAlerts = False
.Range("a1") = myinspector.CurrentItem.CompanyName
.Range("a2") = myinspector.CurrentItem.Title & " " & myinspector.CurrentItem.LastName & " " & myinspector.CurrentItem.FirstName
.Range("a3") = myinspector.CurrentItem.HomeAddressStreet
.Range("a4") = myinspector.CurrentItem.HomeAddressPostalCode & " " & myinspector.CurrentItem.HomeAddressCity
.Range("a5") = "Tél. : " & myinspector.CurrentItem.HomeTelephoneNumber
.Range("a6") = "Fax : " & myinspector.CurrentItem.TelexNumber
.Range("a7") = "Portbale : " & myinspector.CurrentItem.MobileTelephoneNumber
.Range("a8") = "Mail : " & myinspector.CurrentItem.Email1Address
.Activate
With appExcel.ActiveSheet
.Application.ActivePrinter = "ZDesigner TLP 2824 Plus (ZPL) sur Ne00:"
ExecuteExcel4Macro _
"PRINT(1,,,1,,,,,,,,2,""ZDesigner TLP 2824 Plus (ZPL) sur Ne00:"",,TRUE,,FALSE)"
End With
.Application.ScreenUpdating = True
.Application.DisplayAlerts = True
End With
appExcel.Application.DisplayAlerts = False
appExcel.Workbooks("Outlook etiquette client.xls").Close
appExcel.Quit
appExcel.Application.DisplayAlerts = True
Set appExcel = Nothing |
Partager