cybereddie
01-28-2020, 06:28 PM
Hello and thank you for any assistance on this in advance!!!!! :banghead:
I have this vbs file
Option Explicit
Dim xlApp
Dim xlBook
Dim CSVBook
Set xlApp = CreateObject("Excel.Application")
xlApp.DisplayAlerts = False
xlApp.Application.Visible = False
Set CSVBook = xlApp.Workbooks.Open ("D:\Input\export1.csv")
CSVBook.SaveAs "D:\Input\DealerFinderUSAReport.xls", 56
CSVBook.Close
Set xlBook = xlApp.Workbooks.Open ("D:\Macro\DealerFinderUSA.xlsm")
xlApp.Run "Macro1"
xlBook.Close
Set xlBook = Nothing
xlApp.Quit
Set xlApp = Nothing
WScript.Quit
Also, The long long macro ends on theses lines:
Sub Macro1()
.
.
.
.
For Each mySheet In ActiveWorkbook.Worksheets
myPath = "D:\Input\USA_"
ActiveWorkbook.Sheets(mySheet.Index).Copy
ActiveWorkbook.SaveAs Filename:=myPath & mySheet.Name & "-" & years & months & days & hrs & mins & secs, FileFormat:=xlCSV, CreateBackup:=True
ActiveWorkbook.Close
Next mySheet
End Sub
The result of these is that all the lines of the macro1 run properly (all csv files are saved properly) BUT the Excel remains running and the wscript remains running too.
Any ideas where is the issue?
I have this vbs file
Option Explicit
Dim xlApp
Dim xlBook
Dim CSVBook
Set xlApp = CreateObject("Excel.Application")
xlApp.DisplayAlerts = False
xlApp.Application.Visible = False
Set CSVBook = xlApp.Workbooks.Open ("D:\Input\export1.csv")
CSVBook.SaveAs "D:\Input\DealerFinderUSAReport.xls", 56
CSVBook.Close
Set xlBook = xlApp.Workbooks.Open ("D:\Macro\DealerFinderUSA.xlsm")
xlApp.Run "Macro1"
xlBook.Close
Set xlBook = Nothing
xlApp.Quit
Set xlApp = Nothing
WScript.Quit
Also, The long long macro ends on theses lines:
Sub Macro1()
.
.
.
.
For Each mySheet In ActiveWorkbook.Worksheets
myPath = "D:\Input\USA_"
ActiveWorkbook.Sheets(mySheet.Index).Copy
ActiveWorkbook.SaveAs Filename:=myPath & mySheet.Name & "-" & years & months & days & hrs & mins & secs, FileFormat:=xlCSV, CreateBackup:=True
ActiveWorkbook.Close
Next mySheet
End Sub
The result of these is that all the lines of the macro1 run properly (all csv files are saved properly) BUT the Excel remains running and the wscript remains running too.
Any ideas where is the issue?