Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

VB Script Not Working on All Computers

$
0
0
I am running a VBScript which I want to open an Excel workbook, load a .bas file, then save the Excel workbook. The vbscript works on one PC but not on any other PC. No error is being thrown either. What is causing this macro to not work on any other PC? On other PC's I see a temp file created, meaning to me that the workbook is being opened, but nothing else happens...

Code:

if WScript.Arguments.Count < 1 Then 
        WScript.Echo "Drop file on to me to process." 
        Wscript.Quit
End If
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Open(Wscript.Arguments.Item(0))
Set oVBC = oBook.VBProject.VBComponents
oVBC.Import("Z:\Test.bas")
oBook.Application.Run "Test"
if Err.Number <> 0 Then
        oExcel.DisplayAlerts = False
        oExcel.Close False
End If


Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>