Hello,
I have a problem with one of our many clients. We have an "old" software written in VB6.0 that uses Word automation. Since the software runs on various Windows-Plattforms with different Windows- and Office-versions it uses late binding. Usually
we have relativly few problems and if we have them, they often happen to all users with a special version or patch level or else happen to more than one customer.
Now I have the situation, that I have only one customer, who uses Office 2013 Home & Business, that has exactly one line of code seemingly not working (but not raising an error either).
The code snippet is as follows:
mDocument.Application.Selection.GoTo wdGoToBookmark, , , Bookmark
mDocument.Application.Selection.SelectRow
If Bookmark = "Anlage7" Then
mDocument.Application.Selection.MoveDown wdLine, 4, wdExtend
MsgBox mDocument.Application.Selection.Text, vbOKOnly, "Debug" 'just to see what's selected
End If
mDocument.Application.Selection.Copy
Problem is the line "mDocument.Application.Selection.MoveDown wdLine, 4, wdExtend", where "mDocument" is declared as "Word.Document". The variable "Bookmark" is set to "Anlage7" externally.
The lines to select are in a table where one "row" internally consists of 5 rows and some fields are merged in some columns. So the first ".SelectRow" selects the actual first row and the ".MoveDown" is supposed to select the
rest of the "row".
It is working perfectly well in my various test environments with various Word versions and also with our other customers with various Word versions, even with Word 2013. Only for one customer it doesn't work, there is allways only the first row selected.
I have read, that using the "Selection" might not be the best idea, that "Range" might be better, but the code is working for over 10 years now and the saying is "never touch a running system", isn't it?
Has anyone an idea what could be the problem here? Thanks in advance.