Get the filename of excel


#1

Guys is there any method to get the filename of an excel inside the excel app scope activity


I am having an excel file,how to get the name of the file and store it in a variable and display it in a message box?
#2

Yes @renjith_krishnan

Path::GetFileName Method (String^) - Returns the file name and extension of the specified path string.

String^ fileName = “C:\mydir\myfile.ext”;
String^ path = “C:\mydir\”;
String^ result;
result = Path::GetFileName( fileName );
Console::WriteLine( “GetFileName(’{0}’) returns ‘{1}’”, fileName, result );

// This code produces output similar to the following:
//
// GetFileName(‘C:\mydir\myfile.ext’) returns ‘myfile.ext’

to get the filename path should contain the file name as well.

So better to Get all files from directory and iterate it with required argument (search forum for it.) then inside that you just have to pass iteam variable.(suppose).

Regards…!!
Aksh