Excel VBS script to prevent Excel prompt

Joined
Apr 8, 2011
Messages
1
Reaction score
0
I have a vbs that convert old xls to a new xls, then saves it.
When the save line executes, it asks:
A file named --- already exists in this location. Do you want to replace it? How can I automated this prompt to replace exiting file? see code below..
<<ednetmanFormatExcel "c:\test\Hourly Priority Report rev.xls"
Sub ednetmanFormatExcel(ByVal vFilePath)
Dim xlApp
Set xlApp = CreateObject("excel.application")
With xlApp.Workbooks.Open(vFilePath) 'open file
With .ActiveSheet
End With
.SaveAs Left(vFilePath, Len(vFilePath) - 5) & ".xls", -4143 '-4143=xlWorkbookNormal
.Close SaveChange=True
End With
xlApp.Quit
Set xlApp = Nothing
End Sub>>
 
Back
Top