Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with error message, creating word document 1

Status
Not open for further replies.

upplepop

IS-IT--Management
Jun 1, 2002
173
US
I keep getting this error:
"Object doesn't support this property or method."

Here is my code:

Dim docObject As Object
Set docObject = CreateObject("word.application")
docObject.Visible = True
Set Document = docObject.Documents.Add _
("//ALTSP1/Database/Recommendation.dot")
txtCase.SetFocus
docObject.SaveAs (txtCase.Text + ".doc")
On Error Resume Next
docObject.UserControl = True


I want a command button that opens a Word document based on a template (recommendation.dot) and save it as the Case Number (ie 7834.doc) Also, if anyone can think of a way to use this same button to open the document if it has already been created, that would be a big help.

Thanks a lot.
 
"Object doesn't support..." usually means that you do not have the reference library selected. Go do a vb desitn mode and check references. Find ms WORD and make sure it is checked.

rollie@bwsys.net
 
I have my Word and Office references. Are you guys sure there's nothing wrong with my code???
 
I just posted a similar question "create word doc"
I found code at p.299 of the Microsoft Access 2000 VBA book (by Callahan). The code is setout in my post. There are still bugs in it, but it does call up the word document and sends the designated fields to the templates bookmarks.

Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top