VBS script to prevent Excel prompt

Excel Discussion in 'Microsoft Office' started by yumitho, Apr 8, 2011.

  1. yumitho

    yumitho

    Joined:
    Apr 8, 2011
    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. Andrew Marsh

    Excel Excel Problems

    Andrew Marsh, May 29, 2005, in forum: Microsoft Office
    Replies:
    9
    Views:
    875
    Andrew Marsh
    Jun 1, 2005
  2. MFG

    Excel Batch removal of empty cells in Excel

    MFG, Jun 3, 2005, in forum: Microsoft Office
    Replies:
    4
    Views:
    1,080
  3. gazza

    Excel Autofilter in protected shared excel 97

    gazza, Jun 6, 2005, in forum: Microsoft Office
    Replies:
    0
    Views:
    658
    gazza
    Jun 6, 2005
  4. abaxt

    Excel File SaveAs Command in Excel

    abaxt, Jun 8, 2005, in forum: Microsoft Office
    Replies:
    3
    Views:
    1,101
    crazylegs
    Jun 8, 2005
  5. williadn

    Excel VB 6 with Excel

    williadn, Jun 9, 2005, in forum: Microsoft Office
    Replies:
    0
    Views:
    637
    williadn
    Jun 9, 2005
  6. renkumari
    Replies:
    0
    Views:
    2,598
    renkumari
    May 30, 2009
  7. mavi1122

    Excel Prevent Excel from Opening an Access Database

    mavi1122, Jan 12, 2010, in forum: Microsoft Office
    Replies:
    0
    Views:
    733
    mavi1122
    Jan 12, 2010
  8. GodBlessJoanie

    Excel Can't open an Excel file unless Excel is open

    GodBlessJoanie, Aug 25, 2010, in forum: Microsoft Office
    Replies:
    3
    Views:
    758
    smithb2
    Aug 31, 2010
Loading...