Solved

Accessing a current Word Document

Posted on 2004-10-08
7
168 Views
Last Modified: 2010-04-23
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
Comment
Question by:dev-ngps7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 7

Expert Comment

by:J_Mak
ID: 12258476
what's intFileCount?

Why don't you just keep the argument as arrStringPath?
0
 
LVL 7

Expert Comment

by:J_Mak
ID: 12258531
If that doesn't wrok, maybe this link will help:

http://support.microsoft.com/default.aspx?kbid=286892
0
 
LVL 4

Expert Comment

by:gdexter
ID: 12258856
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!

 
LVL 28

Accepted Solution

by:
iboutchkine earned 500 total points
ID: 12259784
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
 
LVL 8

Expert Comment

by:wguerram
ID: 12267985
Try hardcoding the file name:

actDoc = WordApp.Documents.Open("c:\test1.doc")
0
 

Author Comment

by:dev-ngps7
ID: 12317442
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question