none
Wie Word Dokument aus Access heraus öffnen im Vordergrund RRS feed

  • Frage

  • Hallo Leute,

    ich kann Word aus ACCESS VBA  heraus öffnen mit:

       Dim oWordApp As Object
        Dim oWordDoc As Object

     Set oWordDoc = CreateObject("\\iaf-data\srombach\Eigene Dokumente\test.doc")

      oWordDoc.Application.Visible = True
        
        Set oWordApp = Nothing
        Set oWordDoc = Nothing

    Leider bleibt Word im Hintergrund, und es sollte schreibgeschützt geöffnet werden.

    Wie hole ich Word nach vorne?

    Grüsse



    Dienstag, 16. Februar 2016 15:05

Antworten

  • Hallo Horides,

    damit sollte es klappen:

    Public Sub OpenWord(Dateiname As String)
    
    Dim appWord As Word.Application
    Dim docWord As Word.Document
    
        Set appWord = New Word.Application
        appWord.Documents.Open Dateiname, ReadOnly:=True
        appWord.Visible = True
        appWord.Activate
        AppActivate appWord.Caption
    End Sub
    

    Dabei musst Du aber daran denken die Verweise auf die Word Object Library zu setzen.

    Grüße

    Roland

    Mittwoch, 17. Februar 2016 07:28

Alle Antworten

  • Hallo Horides,

    damit sollte es klappen:

    Public Sub OpenWord(Dateiname As String)
    
    Dim appWord As Word.Application
    Dim docWord As Word.Document
    
        Set appWord = New Word.Application
        appWord.Documents.Open Dateiname, ReadOnly:=True
        appWord.Visible = True
        appWord.Activate
        AppActivate appWord.Caption
    End Sub
    

    Dabei musst Du aber daran denken die Verweise auf die Word Object Library zu setzen.

    Grüße

    Roland

    Mittwoch, 17. Februar 2016 07:28
  • Vielen Dank Roland,

    es klappt. :-)

    grüsse Horides

    Mittwoch, 17. Februar 2016 10:30