1

我想为用户变量而不是系统变量设置一个新的环境变量名称“Sample”和值“E:\Sample”。

如何使用 VBA excel 执行此操作?

谢谢你和亲切的问候,

4

1 回答 1

1
Sub addEnvironVariables()

    Dim WSS: Set WSS = CreateObject("WScript.Shell")
    Set System = WSS.Environment("User")
    System.Item("Sample") = System.Item("Sample") & ";C:\Sample"

End Sub

Found it on youtube

于 2022-01-19T10:06:44.450 回答