Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Tue Jan 29, 2019 10:57 am

Good morning,

Is there the possibility to create a hyperlink to lauch an application and pass to it a parameter?

This is the C# code I wrote to launch my bat file but I'm not able to pass a parameter. I receive always the error "Cannot open the specified file"
With this code I create a hyperlink to each row of my list.

CellRange range = worksheet.Range[row, namedRange.Column];
HyperLink hyperlink = worksheet.HyperLinks.Add(range);
hyperlink.Type = HyperLinkType.File;
hyperlink.TextToDisplay = barReport.BarCode;
hyperlink.Address = "d:\\Test.bat " + barReport.BarCode;

In alternative there is a way of doing this using buttons, macro or any other thing?

Thank you
Filippo

Filodo72
 
Posts: 2
Joined: Tue Jan 29, 2019 10:37 am

Wed Jan 30, 2019 7:50 am

Hi,

Thanks for your inquiry.
Note the address is the path of your file. As for the error, it is because you used wrong path. Please change it to the correct path(hyperlink.Address = "d:\\Test.bat ";).
Besides, please make sure the string in bat file could start the exe and open your file correctly.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Feb 18, 2019 9:17 am

Hi,

Greetings from E-iceblue.
Has your issue been resolved? Could you please give us some feedback at your convenience?

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Feb 18, 2019 10:54 am

Hi,

I did not manage to solve the issue.
The problem is not running a application but running an application passing a parameter.

Best regards
Filippo

Filodo72
 
Posts: 2
Joined: Tue Jan 29, 2019 10:37 am

Tue Feb 19, 2019 3:52 am

Hi Filippo,

Sorry to hear that.
As per my understanding, you want to open a specific file with an exe. As far as I know, opening a bat file could achieve the target. For example, write following sting in a bat file, clicking the bat file could open a txt file placed in D dish with Notepad++.
Code: Select all
start notepad++ "d:\\text.txt"

Please make sure you write correct string in the bat file, then hyperlink to the bat file in Excel file.
Code: Select all
hyperlink.Address = "d:\\Test.bat ";

If I misunderstood, please provide more information for further investigation.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Feb 28, 2019 8:17 am

Hi Filippo,

Greetings from E-iceblue.
Has your issue been resolved? Could you please give us some feedback at your convenience?

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.XLS