OVH Cloud OVH Cloud

VBA Outlook & Excel

1 réponse
Avatar
lucio
Bonjour,
J'ai cr=E9=E9 une feuille VBA dans Outlook. A partir de cette=20
feuille je voudrais ouvrir un classeur Excel (voir le=20
cr=E9er) et l'alimenter. Si je declare une variable en tant=20
que Excel.application quand j'appelle la propri=E9t=E9 .open=20
suivi de l'adresse du fichier excel il me dit que le bloc=20
with ou la variable sont non d=E9fini. Si quelqu'un pouvais=20
m'aider =E7a m'arrangerait bien.
D'avance merci

1 réponse

Avatar
Philippe
Essayez plutôt ceci :

J'ai fait le test et ça marche

Dim objExcel As New Excel.Application

Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Open "C:Exceltoto.xls"
...
...

objExcel.Application.Quit
Set objExcel = Nothing