HELP!: "Object doesn't support this property or method"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Otis Hunter

    #1

    HELP!: "Object doesn't support this property or method"

    I have been fighting with this for days and your expert help is
    needed! Below is the code I am executing which results with "Object
    doesn't support this property or method". The error is occuring on
    the "With Me.OLEObject" line (By the way, I haven't found
    documentation which explains what the "With" clause is suppose to
    do?). I am trying to extract a Word document(OLE object) from an
    Access database, for each record in the table, and save it as a Word
    Document. The 4th field of each record is a OLE object type.

    This is a continuation of my recent post "Exporting/Extracting an
    Access OLE object (Word document) to a Word document file" in several
    newsgroups.

    Thank you for your help!

    My Code:

    dim conn
    set conn = CreateObject("A DODB.Connection ")
    conn.Open "provider=micro soft.jet.oledb. 4.0;data
    source=C:\work\ srvScripts.mdb"

    dim rs
    dim NewDoc
    set rs = CreateObject("A DODB.Recordset" )
    'rs.Open "select * from tblTemp", conn
    rs.Open "tblTemp", conn

    'rs.BOF and rs.EOF = True means that there is no records

    rs.MoveFirst
    while not rs.EOF
    set srv = rs.Fields(1)
    set ttl = rs.Fields(2)
    NewDoc = "c:\tst\" & srv & "." & date() & "." & ttl & ".doc"
    ' WScript.Echo NewDoc
    With Me.OLEObject
    .Class = "Word.Docum ent"
    .Verb = acOLEVerbOpen
    .Action = acOLEActivate
    .Object.Applica tion.Documents. Item(1).SaveAs NewDoc
    .Object.Applica tion.Quit
    .Action = acOLEClose
    End With

    rs.MoveNext
    wend
  • Michael \(michka\) Kaplan [MS]

    #2
    Re: HELP!: "Object doesn't support this property or method"

    "Otis Hunter" <junk1acct@yaho o.com> wrote...
    [color=blue]
    > With Me.OLEObject[/color]

    The problem is that forms and reports, there is no such prop? If there were
    it would likely be an Object type, so you should dim a variable of the
    right type and then assign it, rather than relying on With to do the work,
    as that will take longer.


    --
    MichKa [MS]
    NLS Collation/Locale/Keyboard Development
    Globalization Infrastructure and Font Technologies
    Windows International Division

    This posting is provided "AS IS" with
    no warranties, and confers no rights.



    Comment

    • Otis Hunter

      #3
      Re: HELP!: &quot;Object doesn't support this property or method&quot;

      Any chance you, or anyone else, could show me an example of what you
      are talking about or any other solution (I am 1 week new with VBScript
      and fairly new to the windows OS)? Any example code will be greatly
      appreciated!!!

      Respectfully,

      O

      "Michael \(michka\) Kaplan [MS]" <michkap@online .microsoft.com> wrote in message news:<40f2ff36$ 1@news.microsof t.com>...[color=blue]
      > "Otis Hunter" <junk1acct@yaho o.com> wrote...
      >[color=green]
      > > With Me.OLEObject[/color]
      >
      > The problem is that forms and reports, there is no such prop? If there were
      > it would likely be an Object type, so you should dim a variable of the
      > right type and then assign it, rather than relying on With to do the work,
      > as that will take longer.[/color]

      Comment

      • ???

        #4
        Re: HELP!: &quot;Object doesn't support this property or method&quot;


        "Otis Hunter" <junk1acct@yaho o.com> wrote in message
        news:2a61800f.0 407121227.4acdc d42@posting.goo gle.com...[color=blue]
        > I have been fighting with this for days and your expert help is
        > needed! Below is the code I am executing which results with "Object
        > doesn't support this property or method". The error is occuring on
        > the "With Me.OLEObject" line (By the way, I haven't found
        > documentation which explains what the "With" clause is suppose to
        > do?). I am trying to extract a Word document(OLE object) from an
        > Access database, for each record in the table, and save it as a Word
        > Document. The 4th field of each record is a OLE object type.
        >
        > This is a continuation of my recent post "Exporting/Extracting an
        > Access OLE object (Word document) to a Word document file" in several
        > newsgroups.
        >
        > Thank you for your help!
        >
        > My Code:
        >
        > dim conn
        > set conn = CreateObject("A DODB.Connection ")
        > conn.Open "provider=micro soft.jet.oledb. 4.0;data
        > source=C:\work\ srvScripts.mdb"
        >
        > dim rs
        > dim NewDoc
        > set rs = CreateObject("A DODB.Recordset" )
        > 'rs.Open "select * from tblTemp", conn
        > rs.Open "tblTemp", conn
        >
        > 'rs.BOF and rs.EOF = True means that there is no records
        >
        > rs.MoveFirst
        > while not rs.EOF
        > set srv = rs.Fields(1)
        > set ttl = rs.Fields(2)
        > NewDoc = "c:\tst\" & srv & "." & date() & "." & ttl & ".doc"
        > ' WScript.Echo NewDoc
        > With Me.OLEObject
        > .Class = "Word.Docum ent"
        > .Verb = acOLEVerbOpen
        > .Action = acOLEActivate
        > .Object.Applica tion.Documents. Item(1).SaveAs NewDoc
        > .Object.Applica tion.Quit
        > .Action = acOLEClose
        > End With
        >
        > rs.MoveNext
        > wend[/color]


        Comment

        • ???

          #5
          Re: HELP!: &quot;Object doesn't support this property or method&quot;


          "Otis Hunter" <junk1acct@yaho o.com> wrote in message
          news:2a61800f.0 407121227.4acdc d42@posting.goo gle.com...[color=blue]
          > I have been fighting with this for days and your expert help is
          > needed! Below is the code I am executing which results with "Object
          > doesn't support this property or method". The error is occuring on
          > the "With Me.OLEObject" line (By the way, I haven't found
          > documentation which explains what the "With" clause is suppose to
          > do?). I am trying to extract a Word document(OLE object) from an
          > Access database, for each record in the table, and save it as a Word
          > Document. The 4th field of each record is a OLE object type.
          >
          > This is a continuation of my recent post "Exporting/Extracting an
          > Access OLE object (Word document) to a Word document file" in several
          > newsgroups.
          >
          > Thank you for your help!
          >
          > My Code:
          >
          > dim conn
          > set conn = CreateObject("A DODB.Connection ")
          > conn.Open "provider=micro soft.jet.oledb. 4.0;data
          > source=C:\work\ srvScripts.mdb"
          >
          > dim rs
          > dim NewDoc
          > set rs = CreateObject("A DODB.Recordset" )
          > 'rs.Open "select * from tblTemp", conn
          > rs.Open "tblTemp", conn
          >
          > 'rs.BOF and rs.EOF = True means that there is no records
          >
          > rs.MoveFirst
          > while not rs.EOF
          > set srv = rs.Fields(1)
          > set ttl = rs.Fields(2)
          > NewDoc = "c:\tst\" & srv & "." & date() & "." & ttl & ".doc"
          > ' WScript.Echo NewDoc
          > With Me.OLEObject
          > .Class = "Word.Docum ent"
          > .Verb = acOLEVerbOpen
          > .Action = acOLEActivate
          > .Object.Applica tion.Documents. Item(1).SaveAs NewDoc
          > .Object.Applica tion.Quit
          > .Action = acOLEClose
          > End With
          >
          > rs.MoveNext
          > wend[/color]


          Comment

          Working...