sure, first add references to Microsoft.Office.Core (Microsoft Office 14.0 Object Library) and Microsoft.Office.Interop.Excel (Microsoft Excel 14.0 Object Library).
Also you need to incorporate the packages as well.
Ans then try the below code afterwards, I have to follow some tricks (using MS excel application) to open the dialog though the code is not opening the excel but the folder selection window.
Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Core.FileDialog fileDialog = app.get_FileDialog(Microsoft.Office.Core.MsoFileDialogType.msoFileDialogFolderPicker);
fileDialog.InitialFileName = "c:\\Temp\\"; //something you want
int nres = fileDialog.Show();
if (nres == -1)
{
Microsoft.Office.Core.FileDialogSelectedItems selectedItems = fileDialog.SelectedItems;
string[] selectedFolders = selectedItems.Cast<string>().ToArray();
if (selectedFolders.Length > 0)
{
string selectedFolder = selectedFolders[0];
pdfFolderPath=selectedFolder;
}
}
Also create an argument and incorporate it in the invoke code.
Working code for me vb.net
(Studio 21.10.4, System.Activities 22.10.4, Windows-Legacy project)
Invoke code activity:
Dim xl As New Microsoft.Office.Interop.Excel.ApplicationClass
Dim fd As Microsoft.Office.Core.FileDialog
fd = xl.FileDialog(MsoFileDialogType.msoFileDialogFolderPicker)
fd.Title="Select folder you want to process"
fd.AllowMultiSelect=False
fd.ButtonName="Choose folder"
fd.Show()
result = fd.SelectedItems(0).ToString