Macro won't run on certain machines but on mostly others

D

Dorak

We use Word 2003XP

Message: "This feature is disabled because it is not compatible with
Microsoft Word 97"

On certain machines, debug produces issue at following code:
Selection.PasteAndFormat (wdPasteDefault)

An AutoNew macro displays user form to collect data.
Complete code not including the AutoNew macro is below:

Private Sub CommandButton1_Click()

End Sub

Private Sub CancelBtn_Click()
Dim intResponse As Integer
intResponse = MsgBox("Are you sure you want to quit?", _
vbYesNo + vbQuestion, "Quit")
If intResponse = vbYes Then
NewMatter2.Hide
Unload NewMatter2
Else
Exit Sub
End If

End Sub

Private Sub OKBtn_Click()
With ActiveDocument
Selection.GoTo What:=wdGoToField, Which:=wdGoToNext, Count:=1, Name:= _
"MACROBUTTON"
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=1
End With

If TextBox1 = "" Then
MsgBox ("All fields must be completed!")
Exit Sub
End If
If TextBox2 = "" Then
MsgBox ("All fields must be completed!")
Exit Sub
End If
If TextBox3 = "" Then
MsgBox ("All fields must be completed!")
Exit Sub
End If
If TextBox4 = "" Then
MsgBox ("All fields must be completed!")
Exit Sub
End If
If TextBox5 = "" Then
MsgBox ("All fields must be completed!")
Exit Sub
End If
If TextBox6 = "" Then
MsgBox ("All fields must be completed!")
Exit Sub
End If
If TextBox7 = "" Then
MsgBox ("All fields must be completed!")
Exit Sub
End If
If cboPgroup = "" Then
MsgBox ("You Must Choose a Practice Group")
Exit Sub
End If


With ActiveDocument
.Bookmarks("FileNo").Range.Text = TextBox1.Value
.Bookmarks("Client").Range.Text = TextBox2.Value
.Bookmarks("Matter").Range.Text = TextBox3.Value
.Bookmarks("DateOpened").Range.Text = TextBox4.Value
.Bookmarks("OriginatingAttorney").Range.Text = TextBox5.Value
.Bookmarks("BillingAttorney").Range.Text = TextBox6.Value
.Bookmarks("ResponsibleAttorney").Range.Text = TextBox7.Value
.Bookmarks("PracticeGroup").Range.Text = cboPgroup.Value
End With

Selection.Tables(1).Select
Selection.Copy
Selection.GoTo What:=wdGoToBookmark, Name:="Folder2Paste"
Selection.PasteAndFormat (wdPasteDefault)
Selection.GoTo What:=wdGoToBookmark, Name:="Folder3Paste"
Selection.PasteAndFormat (wdPasteDefault)
Selection.GoTo What:=wdGoToBookmark, Name:="Folder4Paste"
Selection.PasteAndFormat (wdPasteDefault)
Selection.GoTo What:=wdGoToBookmark, Name:="Folder5Paste"
Selection.PasteAndFormat (wdPasteDefault)

NewMatter2.Hide
Unload NewMatter2

End Sub

Private Sub UserForm_Initialize()
With cboPgroup
.AddItem "B"
.AddItem "BT"
.AddItem "CCL"
.AddItem "EEDR"
.AddItem "IP"
.AddItem "MM"
.AddItem "PI"
.AddItem "RE"
.AddItem "TWE"
End With
End Sub
 
C

Cindy M.

Hi =?Utf-8?B?RG9yYWs=?=,
We use Word 2003XP

Message: "This feature is disabled because it is not compatible with
Microsoft Word 97"

On certain machines, debug produces issue at following code:
Selection.PasteAndFormat (wdPasteDefault)
Because PasteAndFormat was not available in Word 97 (or 2000, as I
recall).

If you want to use the default, how about just Selection.Paste?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
D

Dorak

The option "Disable all features after Word 97" was checked. Unchecked it,
and everything is fine now. Thanks, Cindy.
 

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