Opening a VSTO Excel Cusomization Via Intranet
We have a few reports on a network drive which have links pointing to them on the intranet.
I would like to pass a parameter from the link to the Excel Startup method so the excel workbook can respond based on the parameter value.
Is it possible to pass a parameter (start up value) to excel when opening just via a link?
Re: Opening a VSTO Excel Cusomization Via Intranet
I not sure if I will be of much help but let me try.... What parameters are we looking at?
Re: Opening a VSTO Excel Cusomization Via Intranet
Quote:
Is it possible to pass a parameter (start up value) to excel when opening just via a link?
you could do this in the workbook open event,
or use some scripting to get the value and pass to the call to open the workbook, using shell command
Re: Opening a VSTO Excel Cusomization Via Intranet
Well im pretty sure you can pass openh args from a shell command to normal excel workbooks.
However in this instance I would like figure a way to do it with no script on the calling side.
I basically need (if possible) from a list of hyperlinks on the intranet which display customer numbers the user to be able to click on a link which points at copy of the xlsm on the network, this seems to open an instance of the customisation fine. However at the same time I could do with it passing through the customer number as a parameter so when the workbook loads (it is a report) It can look up the customer data from the database.
Re: Opening a VSTO Excel Cusomization Via Intranet
Then in that case I would suggest you to point that link to a vbs file.
The vbs file will prompt for the customer number and then open the workbook to take the necessary actions...
Re: Opening a VSTO Excel Cusomization Via Intranet
I dont really want to prompt though, if I did point the link at a vbs file could it automatically pass the parameter value as in a URL parameter and the VBS file parse it. The idea is that the user just clicks on the link and the report automatically loads up with the correct data with no further interaction (except for clicking ok on the open file dialog of course).
Re: Opening a VSTO Excel Cusomization Via Intranet
Then how will it feed the 'Customer Number'? or do you want to pre-feed the number in the link?
Re: Opening a VSTO Excel Cusomization Via Intranet
Thats what I was hoping, I was hoping there may be a way to pass it like a parameter in a URL string?
Re: Opening a VSTO Excel Cusomization Via Intranet
you can pass a parameter before the filename, using shell or shellexecute
you need apis to get the passed argument(s)
see http://www.motobit.com/tips/detpg_vba-getcommandline/
for the API code, i tested works good
then pass a command like
Shell """" & Application.Path & "\excel.exe"" /xx/ " & """C:\Users\Public\Book103.xls""", vbNormalNoFocus
where xx is your parameters, you can separate with more /, but no spaces in parameters
then parse out from the full command line