Accessing a current Word Document

Here is a tough and confusing problem i have, please consider the following code

actDoc = WordApp.Documents.Open(arrStringPath(intFileCount))

actDoc is of type Word.Document
WordApp is of type Word.Application
arrStringPath has the pathname of the word document

When debugging, this message appears as the line of code above is processed

* no user rights (i have sufficient rights)
*document name of path invalid (all path names are stored in the array)

I have used a watch to confirm pathnames are being input into the array

Who is Participating?
iboutchkineConnect With a Mentor Commented:
did you try this

'late binding. No references

        Dim objWord As Object
        Dim objDoc As Object

        objWord = CreateObject("Word.Application")
        objDoc = CreateObject("Word.Document")
        objWord.Visible = True

            objDoc = objWord.Documents.Open("c:\temp\doc1.doc")
            MessageBox.Show("Document couldn't be opened")
        End Try
what's intFileCount?

Why don't you just keep the argument as arrStringPath?
If that doesn't wrok, maybe this link will help:
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.


 actDoc = WordApp.Documents.Open(arrStringPath(intFileCount).ToString)
Try hardcoding the file name:

actDoc = WordApp.Documents.Open("c:\test1.doc")
dev-ngps7Author Commented:
I wish to close this thread due to the fact that i accidently opened up more threads with the same sort of question. For this, i can only  apologise as i am new to Experts Exchange. This problem can be further discussed here:

Sorry for the inconvenience caused.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.