timb551
asked on
Access and Word 2013 upgrade issue
Hi
We are going through a process of updating our desktops to Office 2013 from 2010.
We have a set of documents located on a network drive running on a Server 2008
Within an Access DB there is a word control function (below) which opens up word documents
In Word 2010 it works fine but it doesnt work in 2013.
Function Private Sub General_Letter_02_Click() is called from a form populated with data that is required to merge to a read only copy of a word letter.
The error we receive using Word 2013 is -
“You are not allowed to edit this selection because it is protected.”
The code fail on line 8 of Public Sub WordReplace(FieldName As String, DataValue As Variant)
Private Sub General_Letter_02_Click()
1. WordOpen "xm-General Letter 02.docx"
2. WordReplace "<Client_File.Title>", Forms![Client File]![TITLE]
3. WordReplace "<Client_File.First>", Forms![Client File]![first]
4. WordReplace "<Client_File.Last>", Forms![Client File]![LAST]
5. WordReplace "<Client_File.Company>", Forms![Client File]![Company]
6. WordReplace "<Client_File.Address1>", Forms![Client File]![Address1]
7. WordReplace "<Client_File.Address2>", Forms![Client File]![ADDRESS2]
8. WordReplace "<Client_File.PostTown>", Forms![Client File]![PostTown]
9. WordReplace "<Client_File.County>", Forms![Client File]![COUNTY]
10. WordReplace "<Client_File.PostCode>", Forms![Client File]![PostCode]
11. WordReplace "<Client_File.Title>", Forms![Client File]![TITLE]
12. WordReplace "<Client_File.Last>", Forms![Client File]![LAST]
13. WordReplace "<Client_File.ClientRef>", Forms![Client File]![ClientRef]
14. WordReplace "<user_security.first_name >", GetCurrentUserFirstName()
15. WordReplace "<user_security.last_name> ", GetCurrentUserLastName()
16. WordReplace "<user_security.Department >", GetCurrentDepartment()
17. WordSaveAsTemporary
18. WordShow
End Sub
Public Sub WordOpen(FileName As String)
1. Set Word = CreateObject("Word.Applica tion")
2. Word.Documents.Open ("L:\word\datasafe letters\worddocs\" & FileName)
End Sub
Public Sub WordReplace(FieldName As String, DataValue As Variant)
1. Dim myRange As Object
2. If (IsNull(DataValue)) Then
3. DataValue = ""
4. End If
5. Set myRange = Word.ActiveDocument.Conten t
6. myRange.Find.Execute FindText:=FieldName, Forward:=True ', MatchCase:=False
7. While (myRange.Find.Found = True)
8. myRange.Text = DataValue
9. Set myRange = Word.ActiveDocument.Conten t
10. myRange.Find.Execute FindText:=FieldName, Forward:=True ', MatchCase:=False
11. Wend
End Sub
thanks
We are going through a process of updating our desktops to Office 2013 from 2010.
We have a set of documents located on a network drive running on a Server 2008
Within an Access DB there is a word control function (below) which opens up word documents
In Word 2010 it works fine but it doesnt work in 2013.
Function Private Sub General_Letter_02_Click() is called from a form populated with data that is required to merge to a read only copy of a word letter.
The error we receive using Word 2013 is -
“You are not allowed to edit this selection because it is protected.”
The code fail on line 8 of Public Sub WordReplace(FieldName As String, DataValue As Variant)
Private Sub General_Letter_02_Click()
1. WordOpen "xm-General Letter 02.docx"
2. WordReplace "<Client_File.Title>", Forms![Client File]![TITLE]
3. WordReplace "<Client_File.First>", Forms![Client File]![first]
4. WordReplace "<Client_File.Last>", Forms![Client File]![LAST]
5. WordReplace "<Client_File.Company>", Forms![Client File]![Company]
6. WordReplace "<Client_File.Address1>", Forms![Client File]![Address1]
7. WordReplace "<Client_File.Address2>", Forms![Client File]![ADDRESS2]
8. WordReplace "<Client_File.PostTown>", Forms![Client File]![PostTown]
9. WordReplace "<Client_File.County>", Forms![Client File]![COUNTY]
10. WordReplace "<Client_File.PostCode>", Forms![Client File]![PostCode]
11. WordReplace "<Client_File.Title>", Forms![Client File]![TITLE]
12. WordReplace "<Client_File.Last>", Forms![Client File]![LAST]
13. WordReplace "<Client_File.ClientRef>",
14. WordReplace "<user_security.first_name
15. WordReplace "<user_security.last_name>
16. WordReplace "<user_security.Department
17. WordSaveAsTemporary
18. WordShow
End Sub
Public Sub WordOpen(FileName As String)
1. Set Word = CreateObject("Word.Applica
2. Word.Documents.Open ("L:\word\datasafe letters\worddocs\" & FileName)
End Sub
Public Sub WordReplace(FieldName As String, DataValue As Variant)
1. Dim myRange As Object
2. If (IsNull(DataValue)) Then
3. DataValue = ""
4. End If
5. Set myRange = Word.ActiveDocument.Conten
6. myRange.Find.Execute FindText:=FieldName, Forward:=True ', MatchCase:=False
7. While (myRange.Find.Found = True)
8. myRange.Text = DataValue
9. Set myRange = Word.ActiveDocument.Conten
10. myRange.Find.Execute FindText:=FieldName, Forward:=True ', MatchCase:=False
11. Wend
End Sub
thanks
As a test only, see if lowering your UAC to its lowest setting helps.
ASKER
VB code within Access.
I will try the UAC tomorrow, thanks
I will try the UAC tomorrow, thanks
ASKER
changing UAC didnt make a difference.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Issue not resolved but no help here.
btw, use always Option Explicit..