how do I get the link name from Excel or VBA










1















I'd like to have my spreadsheet behave differently depending on how I call it.



From file explorer I can double click on either "UHF-test.xlsm" or its shortcut, "VHF-test.lnk". From VBA or an Excel formula, how do I determine which one was used?



If I can't determine the link name, is there another way to pass information in the command line, something like this BAT file



 start "B" EXCEL \qcy-win10-it-2TDS-repositoryTDS-UAXTED.xlsm -VHF









share|improve this question

















  • 1





    If the file and the shortcut(s) are in different folders you could use their paths to determine which is which - Private Sub Workbook_Open() debug.print Application.ActiveWorkbook.Path End Sub

    – Michal Rosa
    Nov 12 '18 at 23:49











  • I don’t think I understand fully. Please explain why you want to know which of them it uses. Or do you just want to create a code, that opens the one you want it to?

    – Patrick S
    Nov 13 '18 at 0:03











  • To answer, "why?", let me explain: I have one spreadsheet with macros I maintain that is able to handle different product types and parameters. When I have to replicate the spreadsheet with only slightly different parameters for differing products and frequency bands, my job becomes really difficult. If through initialization I can identify version and parameters, my job becomes more manageable. Not only that but I don't want to expose my users to the "man behind the curtain", I want their experience to be seamless..

    – Danny Holstein
    Nov 13 '18 at 14:25















1















I'd like to have my spreadsheet behave differently depending on how I call it.



From file explorer I can double click on either "UHF-test.xlsm" or its shortcut, "VHF-test.lnk". From VBA or an Excel formula, how do I determine which one was used?



If I can't determine the link name, is there another way to pass information in the command line, something like this BAT file



 start "B" EXCEL \qcy-win10-it-2TDS-repositoryTDS-UAXTED.xlsm -VHF









share|improve this question

















  • 1





    If the file and the shortcut(s) are in different folders you could use their paths to determine which is which - Private Sub Workbook_Open() debug.print Application.ActiveWorkbook.Path End Sub

    – Michal Rosa
    Nov 12 '18 at 23:49











  • I don’t think I understand fully. Please explain why you want to know which of them it uses. Or do you just want to create a code, that opens the one you want it to?

    – Patrick S
    Nov 13 '18 at 0:03











  • To answer, "why?", let me explain: I have one spreadsheet with macros I maintain that is able to handle different product types and parameters. When I have to replicate the spreadsheet with only slightly different parameters for differing products and frequency bands, my job becomes really difficult. If through initialization I can identify version and parameters, my job becomes more manageable. Not only that but I don't want to expose my users to the "man behind the curtain", I want their experience to be seamless..

    – Danny Holstein
    Nov 13 '18 at 14:25













1












1








1


1






I'd like to have my spreadsheet behave differently depending on how I call it.



From file explorer I can double click on either "UHF-test.xlsm" or its shortcut, "VHF-test.lnk". From VBA or an Excel formula, how do I determine which one was used?



If I can't determine the link name, is there another way to pass information in the command line, something like this BAT file



 start "B" EXCEL \qcy-win10-it-2TDS-repositoryTDS-UAXTED.xlsm -VHF









share|improve this question














I'd like to have my spreadsheet behave differently depending on how I call it.



From file explorer I can double click on either "UHF-test.xlsm" or its shortcut, "VHF-test.lnk". From VBA or an Excel formula, how do I determine which one was used?



If I can't determine the link name, is there another way to pass information in the command line, something like this BAT file



 start "B" EXCEL \qcy-win10-it-2TDS-repositoryTDS-UAXTED.xlsm -VHF






excel vba powershell






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 12 '18 at 23:21









Danny HolsteinDanny Holstein

3017




3017







  • 1





    If the file and the shortcut(s) are in different folders you could use their paths to determine which is which - Private Sub Workbook_Open() debug.print Application.ActiveWorkbook.Path End Sub

    – Michal Rosa
    Nov 12 '18 at 23:49











  • I don’t think I understand fully. Please explain why you want to know which of them it uses. Or do you just want to create a code, that opens the one you want it to?

    – Patrick S
    Nov 13 '18 at 0:03











  • To answer, "why?", let me explain: I have one spreadsheet with macros I maintain that is able to handle different product types and parameters. When I have to replicate the spreadsheet with only slightly different parameters for differing products and frequency bands, my job becomes really difficult. If through initialization I can identify version and parameters, my job becomes more manageable. Not only that but I don't want to expose my users to the "man behind the curtain", I want their experience to be seamless..

    – Danny Holstein
    Nov 13 '18 at 14:25












  • 1





    If the file and the shortcut(s) are in different folders you could use their paths to determine which is which - Private Sub Workbook_Open() debug.print Application.ActiveWorkbook.Path End Sub

    – Michal Rosa
    Nov 12 '18 at 23:49











  • I don’t think I understand fully. Please explain why you want to know which of them it uses. Or do you just want to create a code, that opens the one you want it to?

    – Patrick S
    Nov 13 '18 at 0:03











  • To answer, "why?", let me explain: I have one spreadsheet with macros I maintain that is able to handle different product types and parameters. When I have to replicate the spreadsheet with only slightly different parameters for differing products and frequency bands, my job becomes really difficult. If through initialization I can identify version and parameters, my job becomes more manageable. Not only that but I don't want to expose my users to the "man behind the curtain", I want their experience to be seamless..

    – Danny Holstein
    Nov 13 '18 at 14:25







1




1





If the file and the shortcut(s) are in different folders you could use their paths to determine which is which - Private Sub Workbook_Open() debug.print Application.ActiveWorkbook.Path End Sub

– Michal Rosa
Nov 12 '18 at 23:49





If the file and the shortcut(s) are in different folders you could use their paths to determine which is which - Private Sub Workbook_Open() debug.print Application.ActiveWorkbook.Path End Sub

– Michal Rosa
Nov 12 '18 at 23:49













I don’t think I understand fully. Please explain why you want to know which of them it uses. Or do you just want to create a code, that opens the one you want it to?

– Patrick S
Nov 13 '18 at 0:03





I don’t think I understand fully. Please explain why you want to know which of them it uses. Or do you just want to create a code, that opens the one you want it to?

– Patrick S
Nov 13 '18 at 0:03













To answer, "why?", let me explain: I have one spreadsheet with macros I maintain that is able to handle different product types and parameters. When I have to replicate the spreadsheet with only slightly different parameters for differing products and frequency bands, my job becomes really difficult. If through initialization I can identify version and parameters, my job becomes more manageable. Not only that but I don't want to expose my users to the "man behind the curtain", I want their experience to be seamless..

– Danny Holstein
Nov 13 '18 at 14:25





To answer, "why?", let me explain: I have one spreadsheet with macros I maintain that is able to handle different product types and parameters. When I have to replicate the spreadsheet with only slightly different parameters for differing products and frequency bands, my job becomes really difficult. If through initialization I can identify version and parameters, my job becomes more manageable. Not only that but I don't want to expose my users to the "man behind the curtain", I want their experience to be seamless..

– Danny Holstein
Nov 13 '18 at 14:25












1 Answer
1






active

oldest

votes


















0














The BAT file solution works fairly well, it's a very small file where I can embed some options for running macros. A small downside is that the Excel PATH is not normally in the system execution PATH and needs to be added.



The goal is toI write and maintain one only macro-enabled spreadsheet stored in a network location but with the ability to allow multiple users to use it with different products and parameters without being prompted by a macro on startup.



I still prefer determining the shortcut name if someone has that solution.






share|improve this answer























  • What about using VBA. Environ("username") instead?

    – Michal Rosa
    Nov 13 '18 at 4:45











  • I already use that all the time, the products and parameters are not user dependent, it's product/frequency/power-level dependent. That's why I want to pass in that type of information surreptitiously, through the name.

    – Danny Holstein
    Nov 13 '18 at 14:27











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53271535%2fhow-do-i-get-the-link-name-from-excel-or-vba%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The BAT file solution works fairly well, it's a very small file where I can embed some options for running macros. A small downside is that the Excel PATH is not normally in the system execution PATH and needs to be added.



The goal is toI write and maintain one only macro-enabled spreadsheet stored in a network location but with the ability to allow multiple users to use it with different products and parameters without being prompted by a macro on startup.



I still prefer determining the shortcut name if someone has that solution.






share|improve this answer























  • What about using VBA. Environ("username") instead?

    – Michal Rosa
    Nov 13 '18 at 4:45











  • I already use that all the time, the products and parameters are not user dependent, it's product/frequency/power-level dependent. That's why I want to pass in that type of information surreptitiously, through the name.

    – Danny Holstein
    Nov 13 '18 at 14:27
















0














The BAT file solution works fairly well, it's a very small file where I can embed some options for running macros. A small downside is that the Excel PATH is not normally in the system execution PATH and needs to be added.



The goal is toI write and maintain one only macro-enabled spreadsheet stored in a network location but with the ability to allow multiple users to use it with different products and parameters without being prompted by a macro on startup.



I still prefer determining the shortcut name if someone has that solution.






share|improve this answer























  • What about using VBA. Environ("username") instead?

    – Michal Rosa
    Nov 13 '18 at 4:45











  • I already use that all the time, the products and parameters are not user dependent, it's product/frequency/power-level dependent. That's why I want to pass in that type of information surreptitiously, through the name.

    – Danny Holstein
    Nov 13 '18 at 14:27














0












0








0







The BAT file solution works fairly well, it's a very small file where I can embed some options for running macros. A small downside is that the Excel PATH is not normally in the system execution PATH and needs to be added.



The goal is toI write and maintain one only macro-enabled spreadsheet stored in a network location but with the ability to allow multiple users to use it with different products and parameters without being prompted by a macro on startup.



I still prefer determining the shortcut name if someone has that solution.






share|improve this answer













The BAT file solution works fairly well, it's a very small file where I can embed some options for running macros. A small downside is that the Excel PATH is not normally in the system execution PATH and needs to be added.



The goal is toI write and maintain one only macro-enabled spreadsheet stored in a network location but with the ability to allow multiple users to use it with different products and parameters without being prompted by a macro on startup.



I still prefer determining the shortcut name if someone has that solution.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 12 '18 at 23:54









Danny HolsteinDanny Holstein

3017




3017












  • What about using VBA. Environ("username") instead?

    – Michal Rosa
    Nov 13 '18 at 4:45











  • I already use that all the time, the products and parameters are not user dependent, it's product/frequency/power-level dependent. That's why I want to pass in that type of information surreptitiously, through the name.

    – Danny Holstein
    Nov 13 '18 at 14:27


















  • What about using VBA. Environ("username") instead?

    – Michal Rosa
    Nov 13 '18 at 4:45











  • I already use that all the time, the products and parameters are not user dependent, it's product/frequency/power-level dependent. That's why I want to pass in that type of information surreptitiously, through the name.

    – Danny Holstein
    Nov 13 '18 at 14:27

















What about using VBA. Environ("username") instead?

– Michal Rosa
Nov 13 '18 at 4:45





What about using VBA. Environ("username") instead?

– Michal Rosa
Nov 13 '18 at 4:45













I already use that all the time, the products and parameters are not user dependent, it's product/frequency/power-level dependent. That's why I want to pass in that type of information surreptitiously, through the name.

– Danny Holstein
Nov 13 '18 at 14:27






I already use that all the time, the products and parameters are not user dependent, it's product/frequency/power-level dependent. That's why I want to pass in that type of information surreptitiously, through the name.

– Danny Holstein
Nov 13 '18 at 14:27


















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53271535%2fhow-do-i-get-the-link-name-from-excel-or-vba%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo