Results 1 to 4 of 4

Thread: Opening a Word Document in VB

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90

    Opening a Word Document in VB

    Hello everybody.

    I have a very strange problem.

    I'm trying to open a Word Document in VB.

    This is the code I'm using:
    -----------------
    Dim WrdApp as Word.Application
    dim WrdDoc as Word.Document

    Set WrdApp=new Word.Application
    Set WrdDoc=WrdApp.Documents.Open(FileName:=thefilenameiwanttoopen)
    -------------------

    I tried this code on a PC, and it worked just fine.
    I tried it on another PC, but it's not working.It seems that Word is catching the File somewhere because if I try then to open it from outside VB, I get a message:
    "This File is Locked For Editing...."

    Please Help Me.

    Thank you

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    what is the error you get in VB on the seconds PC when you try to run the code?

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    I've had the same problem and discovered that if I closed the Word session via Task Manager, I was able to open the document.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    Lebanon
    Posts
    90
    Kleinam, the most tricky part is that I ain't getting any error message.

    Hack, in Task Manager doesn't appear any Word Session.
    When running the Program, I don't see that word is being opened (if it is being opened)

    Maybe my syntax is wrong?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width