LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

overwrite file error on "Open/Create/Replace File"

I'm writing a program that creates an Excel file and sends data, etc. I have it set up so that when it gets the error code (code 😎 for "file already exists" it outputs a message to the user that has some instructions for what they need to do. Problem is, that sub-vi already outputs two messages when this error occurs.

Is there a way to disable the messages that the sub-vi outputs?

Thanks
0 Kudos
Message 1 of 4
(2,716 Views)
I believe you have specified a file operation type of "create" when using Open/Create/Replace File".
When I try to write to a file that already exists in this mode, then I get the two dialog boxes you mention:
Dialog Message A - " This file already exists Do you want to replace it?"
Dialog Message B - "File exists"

You could do a couple of things to circumvent this:
1 - Replace the "create" mode going into the "Open/Create/Replace File" with a mode of "create or replace". Now, you will only get one dialog that says "Replace existing ?"

2 - If you open up the "Open/Create/Replace File" VI, you'll notice that it contains the function "File Dialog". "File Dialog" is responsible for generating Dialog Message A as mentioned above. There's nothing you can do about this dialog programmatically except change the mode of the operation ("create" vs. "create or replace").

3 - If you further investigate the block diagram of the "Open/Create/Replace File" VI, you'll also notice that it generates a dialog box that corresponds to Dialog Message B mentioned above. One option for you is to save a copy of the "Open/Create/Replace File" VI and modify this copy--eliminating this extraneous dialog message.

Personally, just changing the mode to "create or replace" seems easiest.

Please see the Word document I've attached which shows screenshots and explanations.

-SciAuto
0 Kudos
Message 2 of 4
(2,702 Views)
Wow... thanks for the excellent response. I think I will try saving a copy of the VI and changing it so it doesn't post the messages. I'd just change it to "create or replace", but I don't want the file to be overwritten... so, I'll take the darker path. Thanks again!
0 Kudos
Message 3 of 4
(2,695 Views)
Hi you can try this.

Kaustubh
VC (Pune)
INDIA
0 Kudos
Message 4 of 4
(2,676 Views)