SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Oct 2009
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    How to call vbscript function from vba

    Hi,

    I have function in test.vbs file

    Public Function fn_add(a,b)
    c = a + b
    msgbox c
    End Function

    from excel vba trying to call but it's not working.
    Private Sub btnExecution_Click()
    On Error Resume Next
    Set objShell = CreateObject("Wscript.Shell")
    Set oobj = objShell.Run("C:\Test.vbs fn_add", "5", "6")
    Set objShell = Nothing
    End Sub


    any idea that how to call vb script function with parameters from vba
    Last edited by pvvsrk; 10-30-2015 at 03:26 AM.

  2. #2
    Member
    Join Date
    May 2011
    Location
    California, US
    Posts
    306
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    I think there shouldnot be any commas between arguements.

    Set objShell = CreateObject("WScript.Shell")
    objShell.Run "ipconfig -all",0,True

    The CMD prompt will not be shown (0) and our script will wait till the program exits before it continues processing (True).
    --
    Vijay

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:13 PM.

Copyright BetaSoft Inc.