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>>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top