Bonjour a tous,
j'ai un scrip avec du vba, j'arrive bien a utiliser une variable de vbs vers vba
mais pas de vba vers vbs
Mavariable ==>ok
Mavariable2==>nok
j'essaye plusieurs combinaisons de guillemet , mais erreur vbscript !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
dim Mavariable,Mavariable2
Mavariable=1
Set sh = WScript.CreateObject("WScript.Shell") 
on error resume next
sh.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Security\accessVBOM",1,"REG_DWORD"
on error goto 0
Set exl = WScript.CreateObject("excel.Application")
exl.Visible = false
set fichxl=exl.workbooks.add
Set mdle = fichxl.VBProject.VBComponents.Add(1)
mdle.CodeModule.InsertLines 1,"sub Macro1()"
mdle.CodeModule.InsertLines 2,"msgbox " & Mavariable
mdle.CodeModule.InsertLines 3,Mavariable2 & " = Mavariable+1" '<=====NOK
mdle.CodeModule.InsertLines 4,""
mdle.CodeModule.InsertLines 5,"End sub"
exl.Run "Macro1"
fichxl.close(false)
exl.quit
Set fichxl=nothing
set mdle=nothing
set exl=nothing
set sh=nothing
msgbox Mavariable2   '<===== "VIDE"
merci pour votre aide !