Results 1 to 5 of 5

Thread: Run Java Application from Word Macro

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2007
    Posts
    3

    Run Java Application from Word Macro

    How to run a Java Application from a Word Macro file using VBA?

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Run Java Application from Word Macro

    Moved from Visual Basic FAQs

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Run Java Application from Word Macro

    probably you can use the shellexecute api
    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

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2007
    Posts
    3

    Re: Run Java Application from Word Macro

    Quote Originally Posted by westconn1
    probably you can use the shellexecute api
    Pls. provide the code.

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Run Java Application from Word Macro

    Code:
    Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _ 
    	 ByVal hwnd As Long, _ 
    	 ByVal lpOperation As String, _ 
    	 ByVal lpFile As String, _ 
    	 ByVal lpParameters As String, _ 
    	 ByVal lpDirectory As String, _ 
             ByVal nShowCmd As Long) As Long
    call like
    vb Code:
    1. ShellExecute 0, "Open", filename, vbNullString, 0, SW_SHOWNORMAL

    this will basically do the same as double clicking the file fileaname, you will need to add the constant sw_shownormal
    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
  •  



Click Here to Expand Forum to Full Width