+ Reply to Thread
Results 1 to 8 of 8

open word from excel...file does not exist error

  1. #1
    tbaam
    Guest

    open word from excel...file does not exist error

    I am trying to open a word dopcument from excel...below is the code I am
    running but I receive the following error....that is runtime error
    524...which indicates that the file does not exit...but it does. I searched
    through the other questions and did make sure that the microsoft Word 11.0
    object library is available. What am I still doing wrong.

    Sub OpenAWordDoc()
    Dim WordApp As Object, WorddDoc As Object

    Set WordApp = CreateObject("Word.Application")
    WordApp.Documents.Open "C:\Documents and Settings\files\Test.doc"
    WorddApp.Visible = True

    End Sub

  2. #2
    Henrich
    Guest

    RE: open word from excel...file does not exist error

    Hi, im using this and it's working. Don't use CreateObject but GetObject like
    this:

    Dim Word As Object
    Dim MyXL As Object

    Sub Open_Wordfile()

    Set Word = GetObject("C:\Documents and Settings\files\Test.doc")
    Set MyXL = GetObject(, "Word.application")
    MyXL.Application.Visible = True

    End Sub

    „tbaam" napÃ*sal (napÃ*sala):

    > I am trying to open a word dopcument from excel...below is the code I am
    > running but I receive the following error....that is runtime error
    > 524...which indicates that the file does not exit...but it does. I searched
    > through the other questions and did make sure that the microsoft Word 11.0
    > object library is available. What am I still doing wrong.
    >
    > Sub OpenAWordDoc()
    > Dim WordApp As Object, WorddDoc As Object
    >
    > Set WordApp = CreateObject("Word.Application")
    > WordApp.Documents.Open "C:\Documents and Settings\files\Test.doc"
    > WorddApp.Visible = True
    >
    > End Sub


  3. #3
    tbaam
    Guest

    RE: open word from excel...file does not exist error

    First, thank you for trying to help me...

    I tried exactly what you have here and now I get

    Run-Time error 432
    Filename or class name not found during automation operation.

    Any other suggestions would be greatly appreciated.


    "Henrich" wrote:

    > Hi, im using this and it's working. Don't use CreateObject but GetObject like
    > this:
    >
    > Dim Word As Object
    > Dim MyXL As Object
    >
    > Sub Open_Wordfile()
    >
    > Set Word = GetObject("C:\Documents and Settings\files\Test.doc")
    > Set MyXL = GetObject(, "Word.application")
    > MyXL.Application.Visible = True
    >
    > End Sub
    >
    > „tbaam" napÃ*sal (napÃ*sala):
    >
    > > I am trying to open a word dopcument from excel...below is the code I am
    > > running but I receive the following error....that is runtime error
    > > 524...which indicates that the file does not exit...but it does. I searched
    > > through the other questions and did make sure that the microsoft Word 11.0
    > > object library is available. What am I still doing wrong.
    > >
    > > Sub OpenAWordDoc()
    > > Dim WordApp As Object, WorddDoc As Object
    > >
    > > Set WordApp = CreateObject("Word.Application")
    > > WordApp.Documents.Open "C:\Documents and Settings\files\Test.doc"
    > > WorddApp.Visible = True
    > >
    > > End Sub


  4. #4
    Henrich
    Guest

    RE: open word from excel...file does not exist error

    Hi, I have tryid my code also in Office 2003 and it was working properly
    (with other path and other file then before). Check your path and the file
    name.

    Henrich

    „tbaam" napÃ*sal (napÃ*sala):

    > First, thank you for trying to help me...
    >
    > I tried exactly what you have here and now I get
    >
    > Run-Time error 432
    > Filename or class name not found during automation operation.
    >
    > Any other suggestions would be greatly appreciated.
    >
    >
    > "Henrich" wrote:
    >
    > > Hi, im using this and it's working. Don't use CreateObject but GetObject like
    > > this:
    > >
    > > Dim Word As Object
    > > Dim MyXL As Object
    > >
    > > Sub Open_Wordfile()
    > >
    > > Set Word = GetObject("C:\Documents and Settings\files\Test.doc")
    > > Set MyXL = GetObject(, "Word.application")
    > > MyXL.Application.Visible = True
    > >
    > > End Sub
    > >
    > > „tbaam" napÃ*sal (napÃ*sala):
    > >
    > > > I am trying to open a word dopcument from excel...below is the code I am
    > > > running but I receive the following error....that is runtime error
    > > > 524...which indicates that the file does not exit...but it does. I searched
    > > > through the other questions and did make sure that the microsoft Word 11.0
    > > > object library is available. What am I still doing wrong.
    > > >
    > > > Sub OpenAWordDoc()
    > > > Dim WordApp As Object, WorddDoc As Object
    > > >
    > > > Set WordApp = CreateObject("Word.Application")
    > > > WordApp.Documents.Open "C:\Documents and Settings\files\Test.doc"
    > > > WorddApp.Visible = True
    > > >
    > > > End Sub


  5. #5
    Dave Peterson
    Guest

    Re: open word from excel...file does not exist error

    Are you sure it's 524 and not 424?

    If the error is really 424, it could be because you misspelled WordApp in the
    ..visible line.

    (I don't get 524 when the file doesn't exist (Office 2003).)

    tbaam wrote:
    >
    > I am trying to open a word dopcument from excel...below is the code I am
    > running but I receive the following error....that is runtime error
    > 524...which indicates that the file does not exit...but it does. I searched
    > through the other questions and did make sure that the microsoft Word 11.0
    > object library is available. What am I still doing wrong.
    >
    > Sub OpenAWordDoc()
    > Dim WordApp As Object, WorddDoc As Object
    >
    > Set WordApp = CreateObject("Word.Application")
    > WordApp.Documents.Open "C:\Documents and Settings\files\Test.doc"
    > WorddApp.Visible = True
    >
    > End Sub


    --

    Dave Peterson

  6. #6
    tbaam
    Guest

    Re: Please don't give up on me yet!

    So I changed the code to this
    Sub Open_Wordfile()
    Dim Word As Object
    Dim MyXL As Object
    Set Word = GetObject("C:\Documents and Settings\files\test.doc")
    Set MyXL = GetObject(, "Word.application")
    MyXL.Application.Visible = True

    End Sub

    The file does exist but I now receive the following error:
    Run-time error 432 "File name or class name not found during automation
    operation"

    ....looked for info on this and found that I need this dll.
    regsvr32.exe C:\WINDOWS\SYSTEM\Dao360.dll

    I installed it and it said it was correct....

    but i still get the error...any ideas







    "Dave Peterson" wrote:

    > Are you sure it's 524 and not 424?
    >
    > If the error is really 424, it could be because you misspelled WordApp in the
    > ..visible line.
    >
    > (I don't get 524 when the file doesn't exist (Office 2003).)
    >
    > tbaam wrote:
    > >
    > > I am trying to open a word dopcument from excel...below is the code I am
    > > running but I receive the following error....that is runtime error
    > > 524...which indicates that the file does not exit...but it does. I searched
    > > through the other questions and did make sure that the microsoft Word 11.0
    > > object library is available. What am I still doing wrong.
    > >
    > > Sub OpenAWordDoc()
    > > Dim WordApp As Object, WorddDoc As Object
    > >
    > > Set WordApp = CreateObject("Word.Application")
    > > WordApp.Documents.Open "C:\Documents and Settings\files\Test.doc"
    > > WorddApp.Visible = True
    > >
    > > End Sub

    >
    > --
    >
    > Dave Peterson
    >


  7. #7
    Dave Peterson
    Guest

    Re: Please don't give up on me yet!

    I saved this from a previous post. Maybe it'll help you:

    Option Explicit
    Sub testme()

    'Dim WDApp As Word.Application
    'Dim WDDoc As Word.Document
    Dim WDApp As Object
    Dim WDDoc As Object
    Dim myDocName As String
    Dim myPWD As String
    Dim WordWasRunning As Boolean
    Dim testStr As String

    myDocName = "C:\my documents\word\doc10.doc"
    myPWD = "mypassword"

    testStr = ""
    On Error Resume Next
    testStr = Dir(myDocName)
    On Error GoTo 0
    If testStr = "" Then
    MsgBox "Word file not found!"
    Exit Sub
    End If

    WordWasRunning = True
    On Error Resume Next
    Set WDApp = GetObject(, "Word.Application")
    If Err.Number <> 0 Then
    Set WDApp = CreateObject("Word.Application")
    WordWasRunning = False
    End If

    WDApp.Visible = True 'at least for testing!

    Set WDDoc = WDApp.documents.Open(Filename:=myDocName)

    WDDoc.WritePassword = myPWD
    WDDoc.Close savechanges:=True

    If WordWasRunning Then
    'leave it running
    Else
    WDApp.Quit
    End If

    Set WDDoc = Nothing
    Set WDApp = Nothing

    End Sub

    The purpose of this code was to open a file and give it a password. But there
    might be something that you can use.

    tbaam wrote:
    >
    > So I changed the code to this
    > Sub Open_Wordfile()
    > Dim Word As Object
    > Dim MyXL As Object
    > Set Word = GetObject("C:\Documents and Settings\files\test.doc")
    > Set MyXL = GetObject(, "Word.application")
    > MyXL.Application.Visible = True
    >
    > End Sub
    >
    > The file does exist but I now receive the following error:
    > Run-time error 432 "File name or class name not found during automation
    > operation"
    >
    > ...looked for info on this and found that I need this dll.
    > regsvr32.exe C:\WINDOWS\SYSTEM\Dao360.dll
    >
    > I installed it and it said it was correct....
    >
    > but i still get the error...any ideas
    >
    > "Dave Peterson" wrote:
    >
    > > Are you sure it's 524 and not 424?
    > >
    > > If the error is really 424, it could be because you misspelled WordApp in the
    > > ..visible line.
    > >
    > > (I don't get 524 when the file doesn't exist (Office 2003).)
    > >
    > > tbaam wrote:
    > > >
    > > > I am trying to open a word dopcument from excel...below is the code I am
    > > > running but I receive the following error....that is runtime error
    > > > 524...which indicates that the file does not exit...but it does. I searched
    > > > through the other questions and did make sure that the microsoft Word 11.0
    > > > object library is available. What am I still doing wrong.
    > > >
    > > > Sub OpenAWordDoc()
    > > > Dim WordApp As Object, WorddDoc As Object
    > > >
    > > > Set WordApp = CreateObject("Word.Application")
    > > > WordApp.Documents.Open "C:\Documents and Settings\files\Test.doc"
    > > > WorddApp.Visible = True
    > > >
    > > > End Sub

    > >
    > > --
    > >
    > > Dave Peterson
    > >


    --

    Dave Peterson

  8. #8
    tbaam
    Guest

    Re: Please don't give up on me yet!

    PERFECT!!!!!!!

    Thank You

    "Dave Peterson" wrote:

    > I saved this from a previous post. Maybe it'll help you:
    >
    > Option Explicit
    > Sub testme()
    >
    > 'Dim WDApp As Word.Application
    > 'Dim WDDoc As Word.Document
    > Dim WDApp As Object
    > Dim WDDoc As Object
    > Dim myDocName As String
    > Dim myPWD As String
    > Dim WordWasRunning As Boolean
    > Dim testStr As String
    >
    > myDocName = "C:\my documents\word\doc10.doc"
    > myPWD = "mypassword"
    >
    > testStr = ""
    > On Error Resume Next
    > testStr = Dir(myDocName)
    > On Error GoTo 0
    > If testStr = "" Then
    > MsgBox "Word file not found!"
    > Exit Sub
    > End If
    >
    > WordWasRunning = True
    > On Error Resume Next
    > Set WDApp = GetObject(, "Word.Application")
    > If Err.Number <> 0 Then
    > Set WDApp = CreateObject("Word.Application")
    > WordWasRunning = False
    > End If
    >
    > WDApp.Visible = True 'at least for testing!
    >
    > Set WDDoc = WDApp.documents.Open(Filename:=myDocName)
    >
    > WDDoc.WritePassword = myPWD
    > WDDoc.Close savechanges:=True
    >
    > If WordWasRunning Then
    > 'leave it running
    > Else
    > WDApp.Quit
    > End If
    >
    > Set WDDoc = Nothing
    > Set WDApp = Nothing
    >
    > End Sub
    >
    > The purpose of this code was to open a file and give it a password. But there
    > might be something that you can use.
    >
    > tbaam wrote:
    > >
    > > So I changed the code to this
    > > Sub Open_Wordfile()
    > > Dim Word As Object
    > > Dim MyXL As Object
    > > Set Word = GetObject("C:\Documents and Settings\files\test.doc")
    > > Set MyXL = GetObject(, "Word.application")
    > > MyXL.Application.Visible = True
    > >
    > > End Sub
    > >
    > > The file does exist but I now receive the following error:
    > > Run-time error 432 "File name or class name not found during automation
    > > operation"
    > >
    > > ...looked for info on this and found that I need this dll.
    > > regsvr32.exe C:\WINDOWS\SYSTEM\Dao360.dll
    > >
    > > I installed it and it said it was correct....
    > >
    > > but i still get the error...any ideas
    > >
    > > "Dave Peterson" wrote:
    > >
    > > > Are you sure it's 524 and not 424?
    > > >
    > > > If the error is really 424, it could be because you misspelled WordApp in the
    > > > ..visible line.
    > > >
    > > > (I don't get 524 when the file doesn't exist (Office 2003).)
    > > >
    > > > tbaam wrote:
    > > > >
    > > > > I am trying to open a word dopcument from excel...below is the code I am
    > > > > running but I receive the following error....that is runtime error
    > > > > 524...which indicates that the file does not exit...but it does. I searched
    > > > > through the other questions and did make sure that the microsoft Word 11.0
    > > > > object library is available. What am I still doing wrong.
    > > > >
    > > > > Sub OpenAWordDoc()
    > > > > Dim WordApp As Object, WorddDoc As Object
    > > > >
    > > > > Set WordApp = CreateObject("Word.Application")
    > > > > WordApp.Documents.Open "C:\Documents and Settings\files\Test.doc"
    > > > > WorddApp.Visible = True
    > > > >
    > > > > End Sub
    > > >
    > > > --
    > > >
    > > > Dave Peterson
    > > >

    >
    > --
    >
    > Dave Peterson
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1