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.
Similar Threads
  1. palmerpinckney2

    VBS code for custom Inbox folder

    palmerpinckney2, Oct 16, 2009, in forum: General Software
    Replies:
    1
    Views:
    1,043
    niggszo
    Mar 24, 2010
  2. mavi1122

    Prevent Excel from Opening an Access Database

    mavi1122, Jan 12, 2010, in forum: General Software
    Replies:
    0
    Views:
    507
    mavi1122
    Jan 12, 2010
  3. Obwan

    Excel Macro how to prompt for save name

    Obwan, Oct 19, 2011, in forum: General Software
    Replies:
    1
    Views:
    605
    rajeevcrk
    Nov 15, 2011
  4. clayts
    Replies:
    6
    Views:
    941
    Fair Cape
    Feb 21, 2012
  5. tpatrie

    vbs script wshshell.exe error

    tpatrie, Apr 16, 2014, in forum: General Software
    Replies:
    0
    Views:
    777
    tpatrie
    Apr 16, 2014
Loading...

Share This Page