MATLAB Answers

0

changing the name of the excel file using ActXserver

How can I change the name of the excel file using Actxserver?
for example science.xls to maths.xls
Is it possible??
Is there some other way to do it?
Thanks you

  1 Comments

Note that actxserver is just a way of interfacing with COM interfaces. There are many such COM interfaces. For example you could interact with the COM interface of Scripting.FileSystemObject and do the rename this way in a very roundabout way.
You probably meant to ask how to rename an excel file using Excel COM interface (invoked through actxserver('Excel.Application')). This is not possible this way, since it's not possible in excel. The best you can do is save the file with a different name.
</end pedantic mode>

Sign in to comment.

2 Answers

Answer by Guillaume
on 21 May 2015
 Accepted Answer

The fact the file is an excel file is pretty much irrelevant. You just want to rename a file, which is achieved by movefile regardless of the type of the file.
movefile('science.xls', 'math.xls')
Of course, the file must not be opened for the rename to succeed.

  1 Comments

Sign in to comment.


Answer by Thomas Koelen on 21 May 2015

You could read the file with
xlsread
then save it with the name you want with
xlswrite

  1 Comments

That's a very roundabout and slow way to rename a file!

Sign in to comment.



Translated by