Document Name Doesnt Reflect what is Opened

R

rlm

When we attempt to programmatically open a document with a file spec
of "O:\Docs\Instructions\Corp\DocName.mhtml" with the code listed
below the the correct document is opened. The problem though is that
the document name (objDoc.Name) is "DocumentN" (i.e. Document1). Two
unwanted results are that the information displayed in the Word
titlebar is "DocumentN - Microsoft Word". Also, when moving through
the menu items File > Save As the File name displayed in the Save As
dialog "DocName.mht" and the Save In location is "My Documents". I am
searching for a resource on the topic. However I do not know the Word
object model that well. May I please have a bit of help?

doc2open = "O:\Docs\Instructions\Corp\DocName.mhtml"

Dim objWordApp As Word.Application
Dim objDoc As Word.Document

Set objWordApp = New Word.Application

Set objDoc = objWordApp.Documents.Add(doc2Open)

objWordApp.Visible = True
objWordApp.Activate
 
K

Karl E. Peterson

I don't know the Word object model all that well, either, but the "problem" you
describe sounds more like a By Design issue than anything. It seems that Word isn't
really opening that document, as much as it's importing it into a native file
format. I think you'll need to parse out the source directory and format yourself,
then use those as you will. The behavior you describe seems completely normal from
this angle.
 

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