VBS script to prevent Excel prompt

Discussion in 'General Software' started by yumitho, Apr 8, 2011.

  1. yumitho

    yumitho

    Joined:
    Apr 8, 2011
    Messages:
    1
    Likes Received:
    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>>
     
    yumitho, Apr 8, 2011
    #1
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page