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
| Function impr_OF_GC(sfichier As String, chemin As String)
Dim sAcro As String
Dim wk As ThisWorkbook
Dim i As String
Dim imprim_defaut As String
Dim reachRange As String
Change_Default_Printer ("RV & NB")
sAcro = "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe"
ShellExecute 0, "open", sfichier, "", "", 0
Application.Wait (Now + TimeValue("00:00:03"))
Application.SendKeys "^p", True
Application.Wait (Now + TimeValue("00:00:03"))
Application.SendKeys "%g", True
Application.SendKeys "{TAB}", True
Application.SendKeys "{LEFT}", True
Application.SendKeys "{RIGHT}", True
Application.SendKeys "{BS}", True
Application.SendKeys "2", True
Application.Wait (Now + TimeValue("00:00:02"))
Application.SendKeys "~", True
Application.Wait (Now + TimeValue("00:00:06"))
'selectionne tout le pdf
SendKeys "^a", True
'attend 1 seconde l'exe de la cmd
Application.Wait Now + TimeValue("00:00:01")
'copie les champs du pdf
SendKeys "^c"
'attend 1 seconde l'exe de la cmd
Application.Wait Now + TimeValue("00:00:01")
'active le workbook et la feuille d'import
ThisWorkbook.activate
'vide la feuille d'import
import.Cells.ClearContents
import.activate
Application.Range("a2").Select
import.PasteSpecial Format:="Texte Unicode", Link:=False, _
DisplayAsIcon:=False, NoHTMLFormatting:=True
KillAcrd32
End Function |
Partager