Solved

EXCEL STUFF

Posted on 2006-06-16
2
178 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB 6.0 printer how to align 6 58
Sending a email via excel using vba 6 72
message box in access 4 41
Prevent user closing word document opened with VB6 6 67
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

862 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now