Why would you *expect* the document in strDOC to be loaded automatically?
How would Word possibly know that you wanted that to happen? How would it
know that strDOC held the document name, and not strDir, or strTyp?
You have to *tell* Word to open the document, by using the appropriate Word
method; OPEN, I guess - I do not have Word here to check.
Something like:
> Set objWord = GetObject(strFul)
> objWord.Application.Visible = True
objWord.Open strDOC
HTH,
TC
"Shipp" <(E-Mail Removed)> wrote in message
news:00a901c37179$0bf9d610$(E-Mail Removed)...
> I have the following code in a module. When I execute the
> code Word is loaded and is visible. However, the document
> that is declared in strDOC does not load up automatically.
> Any help would be appreciated.
>
> Private Sub btnWord_Click()
>
> On Error GoTo Err_btnWord_Click
>
> Dim strDir As String
> Dim strDoc As String
> Dim strTyp As String
> Dim strFul As String
> Dim objWord As Word.Document
>
> strDir = Forms!frmConHdr!sfrmDocuments.Form.Directory
> strDoc = Forms!frmConHdr!sfrmDocuments.Form.FileName
> strTyp = Forms!frmConHdr!sfrmDocuments.Form.cboType
> strFul = strDir & strDoc & "." & strTyp
>
> Set objWord = GetObject(strFul)
> objWord.Application.Visible = True
>
> Exit_btnWord_Click:
> Exit Sub
>
> Err_btnWord_Click:
> MsgBox Err.Description
> Resume Exit_btnWord_Click
>
> End Sub
>
|