Results 1 to 2 of 2

Thread: Calling Word to run VBA with parameters

  1. #1
    New Member
    Join Date
    Oct 10
    Posts
    7

    Calling Word to run VBA with parameters

    I am producing an application within PeopleSoft that I need to make a call to windows and initiate a word document that will run a macro upon startup. I can do this piece, no problem the trick is, I want to pass in parameters similar to:

    word.exe MakeDoc.docx "doc0001" "sysadm" "password"

    where the last three terms are parameters that the VBA will utilize. Does anyone know how to take these parms into the VBA macro?

    Thanks.
    Jeff

  2. #2
    PowerPoster
    Join Date
    Dec 04
    Posts
    18,526

    Re: Calling Word to run VBA with parameters

    this is considerably more difficult to do, it requires to use getcommandlineex API
    i may have some example (will look later), but there should be example this forum, else google can help

    edit: see http://www.vbforums.com/showthread.p...n-Via-Intranet
    Last edited by westconn1; Sep 2nd, 2012 at 02:49 AM.
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •