472,108 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,108 software developers and data experts.

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("ADODB.Connection")
conn.Open "provider=microsoft.jet.oledb.4.0;data
source=C:\work\srvScripts.mdb"

dim rs
dim NewDoc
set rs = CreateObject("ADODB.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.Document"
.Verb = acOLEVerbOpen
.Action = acOLEActivate
.Object.Application.Documents.Item(1).SaveAs NewDoc
.Object.Application.Quit
.Action = acOLEClose
End With

rs.MoveNext
wend
Nov 13 '05 #1
4 13926
"Otis Hunter" <ju*******@yahoo.com> wrote...
With Me.OLEObject


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.

Nov 13 '05 #2
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]" <mi*****@online.microsoft.com> wrote in message news:<40********@news.microsoft.com>...
"Otis Hunter" <ju*******@yahoo.com> wrote...
With Me.OLEObject


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.

Nov 13 '05 #3
???

"Otis Hunter" <ju*******@yahoo.com> wrote in message
news:2a**************************@posting.google.c om...
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("ADODB.Connection")
conn.Open "provider=microsoft.jet.oledb.4.0;data
source=C:\work\srvScripts.mdb"

dim rs
dim NewDoc
set rs = CreateObject("ADODB.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.Document"
.Verb = acOLEVerbOpen
.Action = acOLEActivate
.Object.Application.Documents.Item(1).SaveAs NewDoc
.Object.Application.Quit
.Action = acOLEClose
End With

rs.MoveNext
wend

Nov 13 '05 #4
???

"Otis Hunter" <ju*******@yahoo.com> wrote in message
news:2a**************************@posting.google.c om...
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("ADODB.Connection")
conn.Open "provider=microsoft.jet.oledb.4.0;data
source=C:\work\srvScripts.mdb"

dim rs
dim NewDoc
set rs = CreateObject("ADODB.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.Document"
.Verb = acOLEVerbOpen
.Action = acOLEActivate
.Object.Application.Documents.Item(1).SaveAs NewDoc
.Object.Application.Quit
.Action = acOLEClose
End With

rs.MoveNext
wend

Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by ivan divandelen | last post: by
reply views Thread by Jack Wu | last post: by
2 posts views Thread by Charles | last post: by
reply views Thread by =?Utf-8?B?RmFsZ3VuaSBWYWhvcmE=?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.