Try to Print - Error that form is corrupted.

D

Daniel Reyes

I have a custom form tracks requests on converting data fromone format to
another format. Several people will send the form to three operators that
will convert the data. (including me), and we want to be able to print the
request. I have created a word template, added the bookmarks, unchecked the
"Send form definition with item" box on the Properties tab.

When I click the Print button, I'm getting this error “Word was unable to
read this document. It may be corrupt". We have tried to repair, use a text
converter and rewrite the template from scratch. Using Exchagne 5.5, MS
Office 2003 SP3.

The error I get keeps coming up on line 18.

1Sub cmdBookmarks_Click()
2 Dim strTemplate
3 Dim objWord
4 Dim objDocs
5 Dim newDoc
6 Dim PageRange
7 Dim strField
8 Dim strField1
9 Dim mybklist
10 Dim counter
11 Set objWord = CreateObject("Word.Application")
12 ' Put the name of your Word template that contains the bookmarks
13 strTemplate = "PCConversion2.dot"
14
15 ' Location of Word template; could be on a shared LAN
16 strTemplate = "\\atabase$\test\dragon\" & strTemplate
17
18 Set objDocs = objWord.Documents
19 Set newDoc = objDocs.Add(strTemplate)
20 Set mybklist = newDoc.Bookmarks
21
22 For counter = 1 To mybklist.Count
23 strField = mybklist(counter)
24 strField1 = Item.UserProperties.Find(strField).Value
25 If strField1 = True Then
26 strField1 = "Yes"
27 ElseIf strField1 = False Then
28 strField1 = " "
29 End If
30 mybklist(counter).Range.Text = CStr(strField1)
31 Next counter
32
33 newDoc.PrintOut Background:=True
34 objWord.Quit SaveChanges:=False
35End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top