Share via

Running a hidden instance and a visable instance of Word at the same time - is it posible ???

Anonymous
2019-11-28T12:37:09+00:00

I have a test in Access running through 1000's of documents in a hidden instance of Word.

Sometimes users starts up something else while waiting on the test to finish - sometimes it's Word and when they finish the quit Word and unfortunately without knowing kills the hidden server too !

Is it posible to run the hidden instance so that it is NOT affected by the user using Word in visable mode ?

If so how ?

Microsoft 365 and Office | Install, redeem, activate | For home | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. Anonymous
    2019-11-28T18:09:53+00:00

    My Danish is not ...

    2 possibilities I see

    change current

         wdFn = Dir(folder & "*.docx")

    to

         wdFn = Dir(folder & "*.docx" & " /n")

    or maybe

         Set doc = Documents.Open(fileName:=folder & wdFn, Visible:=False)

    to

         Set doc = Documents.Open(fileName:=folder & wdFn & " /n", Visible:=False)

    Give them a try, one at a time.

    In Task Manager you should see a new "MS Word" entry in task manager, where if you expand it, you'll see the appropriate file name.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2019-11-28T17:22:02+00:00

    Here is a little of my code - I use 'doc'  all over the place so it's defined in another module:

    Global doc As Word.Document

        For M = 1 To UBound(docMapper)

            lblVent.Caption = ">>> Vent: Først undersøges links i dokumenter fra mappen: '" & docMapper(M) & "' i familiesystemets hovedmappe !"

            folder = GetPathTo(CurrentDb.Name) & "" & docMapper(M) & ""

            wdFn = Dir(folder & "*.docx")

            Do While Len(wdFn) > 0

                If stopFlag Then Exit Sub

                lblTestet.Caption = testet & ", og heri findes: " & fundneLinkFiler & " linkede lokale filer !"

                Set doc = Documents.Open(fileName:=folder & wdFn, Visible:=False)

                If doc.Hyperlinks.Count > 0 Then

                    For hl = 1 To doc.Hyperlinks.Count

                        DoEvents

                        If InStr(1, doc.Hyperlinks(hl).Address, "http") = 0 And InStr(1, doc.Hyperlinks(hl).Address, "mailto:") = 0 Then

                            ' så er det nget lokalt link og IKKE en 'mailadresse'

                            If extractFileExt(doc.Hyperlinks(hl).Address) <> "" Then

                                ' så HAR der været en Ext på doc.Hyperlinks(hl).Address og så er det en FIL

                                ' så er den interessant og skal gemmes

                                ' Den finder OGSÅ nogle som IKKE er interessante for TESTEN, men hva' ... de forstyrre ikke !

                                DoCmd.SetWarnings False

                                '   On Error Resume Next

                                ' Den styrer åbenbart selv det med dubletter - der kommer INGEN meddelelse

                                DoCmd.RunSQL ("INSERT INTO [TESTING TempTable] VALUES ('" & doc.FullName & "', '" & extractFileName(doc.Hyperlinks(hl).Address) & "');")

                                On Error GoTo 0

                                DoCmd.SetWarnings True

                                fundneLinkFiler = fundneLinkFiler + 1

                            End If

                        End If

                    Next hl

                End If

                testet = testet + 1

                doc.Close

                Set doc = Nothing

                wdFn = Dir()

                DoEvents

            Loop

        Next M

    End Sub

    There is a lot of updating soem labels on the form - just to see how the test is running.

    I often loose the server (the invisible Word instance) and found out that some of the problem is that the user starts up Word for another task while waiting on the test to finish - but unfortunately I often loose it just like that, I see NO reason at all

    • that's why I want to run it sort of 'protected-mode' not affected by other instances of Word - but maybe it can't be done.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2019-11-28T16:54:11+00:00

    No you didn't misunderstand, I did.

    So now the question is exactly how are you starting this word session in VBA?  You may be able to add the same command line parameter, depending on exactly how you starting Word.

    .

    This example would allow you to add the command line parameter inside the BAT file

    .

    DOS from Macroshttp://excelribbon.tips.net/T009843_DOS_from_Macros.html****Need to run a DOS command from within one of your macros? The answer is the Shell command, described in this tip.

    ET MR Macros.docx.

    Give us a couple of lines before and after the command that starts the word session.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2019-11-28T15:41:58+00:00

    I would rather control the start of the HIDDEN instance by VBA so it can be "protected" in some way.

    I don't see any switch I could use there.

    Do I misunderstand something or ... ?

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2019-11-28T14:29:46+00:00

    You want to create a Word shortcut on the desktop

    .

    At the end of the "target" in the shortcut, add /n to start a separate Windows "instance" of Word

    .

    This page has a complete list of the switches for Office applications

    .

    @ Command Line Switches for Office 365- 2019https://support.office.com/en-us/article/Command-line-switches-for-Microsoft-Office-products-079164CD-4EF5-4178-B235-441737DEB3A6

    This page provides switches for Access, Excel, Outlook, PPT, Word. From 2007 to 2019 and 365.

    ET R 0 Ribbon.docx.

    Switches are  a feature left over from the early days of DOS.

    .

    For a while now I've been running in to a problem where Word just "snap" disappears (often while doing the timed recovery saves!).  So if I had multiple documents open in the same Word "instance"/session, I would lose the changes in all of the documents. So, I setup a shortcut on the desktop with the /n switch, and use to start separate instances for all documents. It is a bit of extra work, compared to simply using the File / Open dialog. BUT, in the (not so) long run it has saved me more time not having to recreate unsaved changes. (And no, don't bother suggesting I use OneDrive).

    Was this answer helpful?

    0 comments No comments