LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

'Save As' operation on an excel file (Urgent) ?

Solved!
Go to solution

Hi All,

I have an excel file in my project directory. I want to save or make a copy of that excel file in the directory with a different name i.e. i want to do 'Save As' operation on it whenever user clicks some button. Thanks in advance

 

Best Regards.

Umer.

0 Kudos
Message 1 of 4
(2,967 Views)
Solution
Accepted by topic author umer_awan

If you only want to save a file with a new name, in the button callback you can:

 

  1. (Optional) Use FileSelectPopup to let the user choose the file to operate on. Function will return the complete pathname of the file in a string variable
  2. Use SplitPath to extract the file name and change it accordingly with standard string functions
  3. Use MakePathname to rebuild the complete file pathname in a new string variable
  4. Use CopyFile to operate the copy

All this does not open the file to examine its content.

 



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(2,957 Views)

Hello Roberto,

 

In this, I would like to adda question : - Suppose I have a case in which I have to save a file by any specific name at runtime, means the GUI gives me an option to write the file name at run time and ask me the select a particular directory to save the file. Which specific Labwindows commands must I use to do this?

 

Thanks

Raunak

0 Kudos
Message 3 of 4
(2,696 Views)

Mi previous answer covers your situation too: FileSelectPopup permits you to specify both a file name and a position where to save it, so that function will return the complete pathname to use to save the file.

If on the contrary the file name is given by the program and you want the operator to set the position only, you can use DirSelectPopup function instead. Next you will use MakePathname () to complete the user-supplied path with the machine-generated file name.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 4 of 4
(2,694 Views)