Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB-Excel - freefile

Status
Not open for further replies.

jshanoo

Programmer
Apr 2, 2002
287
IN
Hi all,
I have create log file by vb.
the logfile is created in xls.
the application is executed without any user interaction.
query 1.
My question is once i close the xls file as SaveAs method.

it asks me 'do wnat save the book1.xls file"
it stops to get the 'YES/No/Cancel'.
and the application stops executing here.
is there any way to avoid this.
query2.
xls file is named as "file" & format(date,"dd/mm/yyyy")
but if i execute it again it says teh file is existing.
is there anyway to avoid this by using freefile.

regards
John philip


*** Even the Best, did the Bad and Made the Best ***

John Philip
 
just put
application.displayalerts = false
before the save and
application.displayalerts = true
afterwards

Rgds
Geoff
Si hoc legere scis, nimis eruditionis habes
 
what about the freefile?
how to deal with that?
regards
john philip

*** Even the Best, did the Bad and Made the Best ***

John Philip
 
dunno - If I knew that, I would've answered
what do you mean "freefile" ???

Rgds
Geoff
Si hoc legere scis, nimis eruditionis habes
 
You can query to see if the file you are about to create exist.

I usually use code as below:

If UCASE(Dir("file" & format(date,"dd/mm/yyyy")))) = ("file" & format(date,"dd/mm/yyyy")) then ...

The UCASE statement is necessary since the DIR function will return the file name in all caps.

Freefile will not work for this as it only applies to runtime fileNumbers.

Hope this gets you going.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top