3

I have a couple of projects in VBA which does stuff in Word.

The thing is, currently all the projects that I open are in the same window of VBE. I would like to open more than one window of VBE in a way that there would be one VBE window for each project I open.

The why I want to do that is because I want one project on my left monitor and another on my right monitor. This way I can see both of them at the same time.

Is there a way to do this ? (Google didn't provide me with an answer)

EDIT : Might I add that the projects I have are all .dotm files (even though that is the only way I know to save those type of Word files which are containing VBA).

EDIT 2 : I am using Microsoft Office Professional Plus 2013. Basically Word 2013.

ANSWER : Cindy Meister's answer (see quote below or her comment) is working exactly as I needed.

Word needs special tricks to open a new instance - the installation default is to not allow it. One way is from the command line using the /n switch: filepath\winword.exe /n Another way is to use the New keyword in a macro: Dim wdApp As Word.Application: Set wdApp = New Word.Application: wdApp.Visible = True

Community
  • 1
  • 1
Marks
  • 165
  • 4
  • 19

1 Answers1

3

The VBE is essentially a Multi-Document Interface (MDI) application, where the MDI child windows are confined to the client area of an MDI parent "main" window.

To display an MDI child window in each of your two monitors, you'll need an MDI parent main window in each of your two monitors, too.

And because there's only one MDI parent window per host application instance, if you need two main windows, you need two host application instances.

Open the host document for Project1 in MS-Word, bring up the VBE, put it in monitor 1; then open a new, separate instance of MS-Word (e.g. Shift+Click the MS-Word icon in the task bar), open the host document for Project2 in it, and bring up the VBE; put it in monitor 2.

As long as the two projects aren't interfering with each other, there shouldn't be any problem. If your VBE is loading add-ins, it's possible that they could get confused.

Mathieu Guindon
  • 69,817
  • 8
  • 107
  • 235
  • You bring up a good point there. From what I understand, your solution should work. That being said, and that is probably just me being dumb, when I shift + left click my Word icon in the task bar, it does nothing as when I shift + right click my Word icon in the task bar i have a menu options about hiding the opened documents and so on but no "Create a separate instance". I understood that to create it I needed to follow your procedure of Shift + Click but from there, since there is nothing, my other project host document still opens in the same VBE that is opened for my other project. @Mat – Marks May 31 '16 at 16:11
  • Shift+Click in the taskbar is just a Win7+ shortcut to start a new instance of whatever application you clicked on. Alternatively you could do Windows+R and type "winword" to start a new instance. I do that all the time with an Excel host... – Mathieu Guindon May 31 '16 at 16:14
  • The procedure I do, following your instructions : 1. `Open the first project host document and open the VBE editor (all in the right screen).` 2. `Open another instance of Word using `Ctrl+R -> "winword"` (since it's how I open Word every time I need it).` Once the second instance of Word is loaded, I see it being add in the previously opened VBE. From there, even if I open the VBE again using the second Word document, it still uses the first opened VBE window. In other words, creating a new instance still shows this instance in the already opened VBE. @Mat's – Marks May 31 '16 at 16:24
  • I'm pretty sure how it's implemented is host-specific; looks like MS-Word is somehow *preventing* multiple instances to be launched... I'm stumped here. – Mathieu Guindon May 31 '16 at 16:31
  • 4
    Word needs special tricks to open a new instance - the installation default is to *not* allow it. One way is from the command line using the /n switch: filepath\winword.exe /n Another way is to use the `New` keyword in a macro: `Dim wdApp as Word.Application : Set wdApp = New Word.Application : wdApp.Visible = True` – Cindy Meister May 31 '16 at 18:33
  • Sorry for the delay, I was out of town and couldn't test it. I though just tested it and it worked perfectly. Thanks a lot to both of you Mat's Mug and @Cindy Meister. I'll edit my question with this answer from you Cindy and mark this one as the answer since "The answer" is as a comment and not an answer. – Marks Jun 06 '16 at 12:26