Solved

EXCEL STUFF

Posted on 2006-06-16
2
183 Views
Last Modified: 2010-04-30
HI, i just want Excel to stop asking me if i want to replace a file...

the code look like this:

Dim oXL As Object        
Dim oBook As Object      
Dim oSheet As Object    
...
...
..
Set oXL = New Excel.Application
 Set oBook = oXL.Workbooks.Open("PATH")
 Set oSheet = oBook.Worksheets.Item(1)
...
...
oSheet.Cells(x,y) = bla, bla, bla
...
...
oBook.SaveAs App.Path & "\" & FileName & ".xls" ' HERE IS THE PROBLEM

is there any flag that indicates, from VB, to stop asking if i want to replace the file?

thanks.

0
Comment
Question by:patobrown
2 Comments
 
LVL 5

Accepted Solution

by:
lunchbyte earned 125 total points
ID: 16921942
if dir(oBook.SaveAs App.Path & "\" & FileName & ".xls") <> "" then kill oBook.SaveAs App.Path & "\" & FileName & ".xls"
0
 

Author Comment

by:patobrown
ID: 16922109
Thanks,  it works, but i found in the Intenet:

oXL.DisplayAlerts = False
oBook.SaveAs App.Path & "\" & nombrelocal & ".xls"
oXL.DisplayAlerts = True

it works too.

thanks anyway.

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question