Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to call a Powershell script from VBA? Shell()?

Status
Not open for further replies.

RRinTetons

IS-IT--Management
Jul 4, 2001
333
US
Now that I have a whole directory full of pdf's created from several dozen report tabs I need to distribute them. I've got a Powershell script that will take each report, rename it appropriately and copy it to the proper target directory in the reporting shares. I'd like to make that final step a piece of the Excel/VBA app that creates all the reports to start with.

Is there syntax to call a Powershell script from VBA? Will Shell() do it or is there something else required for dependable results?

-
Richard Ray
Jackson Hole Mountain Resort
 
Shell() would do just fine.

A quick example I knocked up was:
Code:
Dim retval

retval = Shell("powershell ""C:\MyTest.ps1""", 1)
Hope this helps

Andy
---------------------------------
Zebracorn: 50% Zebra, 50% Unicorn = 100% Real.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top