Get the filename of excel

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

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).


1 Like