Opening Word file from Access..

R

RzB

I have added a button to an application to open a
ReleaseNote for the user to view. This is the code I'm
using.. (error handling removed for clarity)
The file opens OK but I have some problems ....

------------------------------------------------------------
Private Sub butViewReleaseNote_Click() '++ CR# 2525

Dim objWordApp As Word.Application
Dim strApplicationPath As String
Dim strFilePathAndName As String

Set objWordApp = New Word.Application

strApplicationPath = GetApplicationPath
strFilePathAndName = strApplicationPath & "ReleaseNote.rtf"

If Dir(strApplicationPath & "ReleaseNote.rtf") <> "" Then
objWordApp.Documents.Open strFilePathAndName
objWordApp.ActiveDocument.ActiveWindow.ActivePane.View.Type = wdNormalView
objWordApp.ActiveDocument.ActiveWindow.ActivePane.View.Zoom.PageFit =
wdPageFitFullPage
objWordApp.Application.Visible = True
Else
MsgBox strFilePathAndName & " not found", vbOKOnly + vbInformation, "Not
Found "
End If

Set objWordApp = Nothing

End Sub
--------------------------------------------------------------

I have two problems....

1. It seems to completely ignore the
ActivePane.View.Type = wdNormalView and
ActivePane.View.Zoom.PageFit = wdPageFitFullPage
statements.

2. When closing the word document I get all kinds of hassle
about normal.dot being changed and do I want to save it...

I must be doing something fundamentally wrong.
Any thoughts..
Many thanks,
Roy
 
H

Heiko

Hello Roy
the Constants you are using are impossible to combine
with

objWordApp.ActiveDocument.ActiveWindow.ActivePane.View.Type =
wdPageView ' wdNormalView
objWordApp.ActiveDocument.ActiveWindow.View.Zoom.PageFit =
wdPageFitFullPage 'wdPageFitBestFit

( or the outcommented NormalView-Pedant) it should work

hth
Heiko
 
R

RzB

Heiko,
Doohhh... Amazing how long one can look at a piece
of code and not spot the stupid mistake, but spend hours
going down all sorts of wrong turnings.. :)

The other problem I had seems to have gone away
after a restart... Hmmm...

Many thanks for your assistance.
Roy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top