0

Automating word from Access... When I use, for example...

Set wordapp = New Word.Application

...word 2003 opens. I want it to open word 2013. How can I specify which version of word is referenced?

I refer to the "microsoft Word 15.0 Object Library", under tools. I can see both word 2003 and word 2013 as default apps to associate with various file types. I cannot see word 2003 among my list of "All apps". This is all under Windows 10

0m3r
  • 12,286
  • 15
  • 35
  • 71
Mark
  • 1
  • 1
  • 1
    Is there *any* reason why one would *need* to have Word 2003 alongside with Word 2013 installed? – Mathieu Guindon Mar 29 '16 at 02:09
  • 1
    A word around could be `WScript.Shell` to start your preferred version of `WINWORD.EXE`, followed by `GetObject()` [as described in a previous answer](http://stackoverflow.com/a/12074636/77335) – HansUp Mar 29 '16 at 02:26
  • 1
    I concur with HansUp: The newest version of Word is the one that registers itself as "the" Word.Application object. This has been Microsoft policy for over a decade, now. The only way to be sure which version you run is to explicitly start up the *.exe. CAVEAT: You need to be sure that an instance of the other version, that you don't want, isn't already running. Otherwise that one will be picked up (the first version to be run will be picked up - it's an Office + Windows thing in the ROT). – Cindy Meister Mar 29 '16 at 06:44
  • You can solve this by re-registering Word 2013. On a command prompt run `"C:\Program Files (x86)\Microsoft Office\Office15\winword.exe" /r` (adjust the path to winword.exe accordingly). This will last until you start any other version of Office. By the way, installing multiple versions of Office side-by-side is not recommended by Microsoft (see here for possible issues and remedies: https://support.microsoft.com/en-us/kb/2784668) – Dirk Vollmar Mar 29 '16 at 20:04

2 Answers2

0

Try something like this...

'// Open word
Option Explicit
Sub Open_Word_App()
    Dim wdApp As Object ' Application

    Set wdApp = CreateObject("Word.Application")
    wdApp.Visible = True

    Set wdApp = Nothing
End Sub
0m3r
  • 12,286
  • 15
  • 35
  • 71
0

Thanks All!

I should have specified, I had already tried late binding, to no avail.

I am refining my automating code between access and word, as well as refining my database. I don't want to switch to the new code that I am working on, until I am sure it works, and works on 2013. Until then, I want to continue to be able to work using the old code and database with 2003. Thus the parallel installations.

A the moment, while I am working on my code for 2013, I just rename winword.exe in programfiles(x86) office11, i.e. hide 2003, and 2013 launches as it should. When I am using the old database and old code, I re-rename, and use 2003 as before.

When the new database and word code are tested, I will re-register 2013 as suggested, and remove 2003.

Thanks again for your thoughts!

Mark.

Mark
  • 1
  • 1