none
Can vb.net call vba code (in Word template) then pass back to vb.net...and how RRS feed

  • Question

  • Background:

    From my code solution Im calling a vendors dialog box
    I reference to the vendors dll
    As a proof of concept to get working and ease of debugging the code I wrote the code in VBA Word template.
    This works and the vendors dialog is called.

    I convert the vba code into my vb.net VS2013 solution, and I get different results. The vendors ShowSaveDialog doesnt display when called, and the dialog displays asynchronous, and the rest of the code continues to execute without waiting for user input on the ShowSaveDialog.


    Possible workaround:

    A global Word.dotm template exists in location
    C:\Program Files (x86)\Microsoft Office\Office15\STARTUP

    As the vba code is working  is it possible from vb.net solution call vba code in word template, and then pass control back to my net solution to continue executing.

    Ive not done this before. 
    and how would this be done
    can you pls provide samples

    Currently in the Word vba template, code calls exists in one direction ie from vba code call vb.net code to execute. eg a Word custom shortcut key is pressed, captured by the vba code to call and execute the function in vb.net and code then completes.


    TIA

    --dd
    Wednesday, July 1, 2015 1:11 AM

Answers

All replies

  • Thank you Ive worked this out 

    This is now resolved.


    Wednesday, July 1, 2015 11:33 PM
  • Hi,

    Since you have worked it out, could you please share the solution to help others in case they have the similar question ?.

    Thank you.

    Best Regards,

    Lan


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, July 2, 2015 1:48 AM
    Moderator
  • in my vb.net solution add the following line of code

    Word.Document.Application.Run(MacroName:="vbaMacroNameHere")

    Thursday, July 2, 2015 3:06 AM