Calling a javascript file (.js) via Excel VBA?

305

All the previously suggested approaches sound hacky to me.

For a more reliable solution, embed the Javascript in a COM component via Windows Script Components, and call the Javascript-based COM component as you would any other COM component.

Share:
305
Markus Freundorfer
Author by

Markus Freundorfer

Updated on June 04, 2022

Comments

  • Markus Freundorfer
    Markus Freundorfer almost 2 years

    I'm new to PHP and trying to include a file in another with the following code:

    <?= require_once ('../template/header.phtml')?>
    

    The inclusion works, but it also adds a "1" to the source code. Same happens if I use include() include_once() or require(). Got no results searching the web as well.

    • Sirko
      Sirko over 8 years
      use <? instead of <?=.
    • Markus Freundorfer
      Markus Freundorfer over 8 years
      @Sirko then the files won't be included
    • Mark Baker
      Mark Baker over 8 years
      <?= will echo the result returned by the require_once() which will be a Boolean true if successful, and the require() doesn't explicitly return a value or echo anything, so that Boolean true will be displayed as 1
    • Mark Baker
      Mark Baker over 8 years
      Use <? as @Sirko said. That will include the file, but not display the boolean true result of the require
    • bladerz
      bladerz over 8 years
      @kvothe try with <?php - see my answer below
  • SANTHOSH.SJ
    SANTHOSH.SJ over 3 years
    require_once returns true if file is already imported. Also returns true if (echo)ed when file is present