• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 171
  • Last Modified:

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

0
dev-ngps7
Asked:
dev-ngps7
1 Solution
 
J_MakCommented:
what's intFileCount?

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

http://support.microsoft.com/default.aspx?kbid=286892
0
 
gdexterCommented:
Try:

 actDoc = WordApp.Documents.Open(arrStringPath(intFileCount).ToString)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
iboutchkineCommented:
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

        Try
            objDoc = objWord.Documents.Open("c:\temp\doc1.doc")
        Catch
            MessageBox.Show("Document couldn't be opened")
        End Try
0
 
wguerramCommented:
Try hardcoding the file name:

actDoc = WordApp.Documents.Open("c:\test1.doc")
0
 
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:

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21166350.html

Sorry for the inconvenience caused.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now