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?

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

    Excel Excel Problems

    Andrew Marsh, May 29, 2005, in forum: Microsoft Office
    Replies:
    9
    Views:
    1,069
    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,251
  3. gazza

    Excel Autofilter in protected shared excel 97

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

    Excel File SaveAs Command in Excel

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

    Excel VB 6 with Excel

    williadn, Jun 9, 2005, in forum: Microsoft Office
    Replies:
    0
    Views:
    770
    williadn
    Jun 9, 2005
  6. renkumari
    Replies:
    0
    Views:
    2,984
    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:
    849
    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:
    948
    smithb2
    Aug 31, 2010
Loading...