Selecting a column in word Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
LeFunk
Posts: 86
Joined: 29 Aug 2016, 03:12

Selecting a column in word

Post by LeFunk » 19 May 2022, 11:44

Hello!

I have used a script for choosing a column in word:

Code: Select all

F12::
oword := ComObjActive("Word.Application")                       
oword.ActiveDocument.Tables(4).Columns(4).Select
oword.Selection.Copy

msgbox % Clipboard     ; for testing
It used to work, but now when I tried it with Word from Office 2021, I get the following error message:

This command is not available because no document is open.
Specifically: ActiveDocument
009: oword.ActiveDocument.Tables(4).Columns(4).Select

Has something been changed in Word? I've attached the file that I use for testing.

Thanks in advance!
Attachments

[The extension docx has been deactivated and can no longer be displayed.]


User avatar
boiler
Posts: 16771
Joined: 21 Dec 2014, 02:44

Re: Selecting a column in word

Post by boiler » 19 May 2022, 17:39

It would show that message if it was opened in "Protected View." If it is, click the "Enable editing" button in the bar at the top.

I wouldn't think that would normally be the case for a file you created, but maybe you moved it from another computer where it used to work.

LeFunk
Posts: 86
Joined: 29 Aug 2016, 03:12

Re: Selecting a column in word

Post by LeFunk » 20 May 2022, 05:46

I'm not sure that's the case, I can still send text to the word document, for example:

Code: Select all

F12::
Send aaaa
oword := ComObjActive("Word.Application")                       
oword.ActiveDocument.Tables(4).Columns(4).Select
oword.Column.Copy
Send bbbb
"aaaa" gets inserted into the word document, and after error messages about line oword.ActiveDocument and line oword.Column.Copy, "bbbb" gets sent.bbbb

Protected view is off, I have tried disabling Word add-ins and enabling all macros in Trust Center, but none of it has helped.

User avatar
boiler
Posts: 16771
Joined: 21 Dec 2014, 02:44

Re: Selecting a column in word  Topic is solved

Post by boiler » 20 May 2022, 07:18

If your copy of Word isn’t registered with Microsoft, some have noted that COM won’t work with it. Also see this thread regarding issues with getting COM to work with MS Office applications.

Post Reply

Return to “Ask for Help (v1)”