Excel Export Question

This forum is for eXpress++ general support.
Post Reply
Message
Author
omni
Posts: 531
Joined: Thu Jan 28, 2010 9:34 am

Excel Export Question

#1 Post by omni »

Roger,

We have a lot of printouts that have a special export to excel, where we actually build the data to a work file and export to a fixed file (excel file) for the user to review the data, especially in our accounting module. There is a problem if the user decides to do another one with different selections (dates,etc) and leaves the excel spreadsheet open. I know to resolve we could use a different file name each time, or let the user assign one, but we prefer to not clutter up the export folder, and not require the user to enter a file name each time.
Do you know of a method to check to see if the excel file can be written to and opened and bypass the file write errors they are getting. We do have this occur a few times a week (error messages emailed to our support desk) and the user eventually figures it out, but we need to fix it one way or another.

Thanks, and have a great Turkey day.

Fred
Omni

Koverhage
Posts: 151
Joined: Mon Feb 01, 2010 8:45 am

Re: Excel Export Question

#2 Post by Koverhage »

Fred,

why not test it with Fopen ?
Klaus

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Excel Export Question

#3 Post by rdonnay »

Klaus has the right idea.

Fopen() will return a handle greater than 0 if the file can be opened.
It will return 0 or -1 if not.

Make sure to close it with FClose().
The eXpress train is coming - and it has more cars.

omni
Posts: 531
Joined: Thu Jan 28, 2010 9:34 am

Re: Excel Export Question

#4 Post by omni »

I could not get that to work right, but something close worked. I first checked to see if the file existed, then used ferase(). If it failed, then created a random file name. It works.
Thanks for leading me in the right direction.

Fred

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Excel Export Question

#5 Post by Tom »

Hi, Fred.
I first checked to see if the file existed, then used ferase().
That may lead to the situation that a user has this file(name) in his Excel-file-history and fails at the attempt to open it again. FOpen() with FClose() avoids this.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Post Reply