LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX Reference for Word._Document SaveAs2 Without Overwrite

Solved!
Go to solution

Hi,

 

I am looking for a way to not overwrite a file when I use the SaveAs2 method in Labview.  Currently it overwrites any existing file with that name and I would like for it to do the usual append a number of sometype to the filename if it already exists.

 

Thanks

0 Kudos
Message 1 of 6
(3,475 Views)

Hi Gus

 

Where is this method located? Could you upload a code snippet or VI which demonstrates the problem?

 

Kind Regards

 

 

Chris | Applications Engineer NIUK
0 Kudos
Message 2 of 6
(3,466 Views)

I attached two screenshots of the code.

Download All
0 Kudos
Message 3 of 6
(3,463 Views)

The second picture is where I use the SaveAs2 method, my goal is to save the word document as a .pdf which works great.  It's just that it overwrites any file with the same name, where I would rather it didn't do that.

 

 

0 Kudos
Message 4 of 6
(3,455 Views)
Solution
Accepted by topic author Gus67

Hi Gus

 

If you check here: http://msdn.microsoft.com/en-us/library/microsoft.office.tools.word.document.saveas(v=vs.80).aspx

(MSDN reference for the ActiveX call) You can see that the expected behaviour of this call is to "If a document with the specified file name already exists, the document is overwritten without the user being prompted first." Since this is as Microsoft intended, and external to LabVIEW this can't be changed.

What we can change is how we use the control. I.e. you could use the Check if File or Folder exists VI with a case structure to modify the file name input if the file already exists?

 

Kind Regards

 

 

Chris | Applications Engineer NIUK
Message 5 of 6
(3,443 Views)

Alright, thanks.

0 Kudos
Message 6 of 6
(3,439 Views)