Search code examples
windows-server-2008com

Create COM object


I want to test creating a COM object. Normally I use Excel or Word VBA and add a reference to the DLL I want to test. However I am on a Windows 2008 server without these programs and only the basic software installed that comes with Windows, plus IIS. How can I create a COM object easily and call its properties and methods?


Solution

  • You could use Powershell.

    For example, this creates new Word App com object:
    $word = new-object -com Word.Application

    If you use PS 3+ ISE, it also includes handy Intellisense: enter image description here

    Full reference here: https://technet.microsoft.com/en-us/library/Hh849885.aspx
    And usage here: https://technet.microsoft.com/en-us/%5Clibrary/Dd347574.aspx