KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Excel command to auto-fit columns not working - invalid flags
Topic Summary:
Created On: 02/11/2022 11:06 AM
Status: Post and Reply
Linear : Threading : Single : Branch
 Excel command to auto-fit columns not working - invalid flags   - wristofdoom - 02/11/2022 11:06 AM  
 Excel command to auto-fit columns not working - invalid flags   - Alan Cantor - 02/11/2022 11:45 AM  
Keyword
 02/11/2022 11:06 AM
User is offline View Users Profile Print this message

Author Icon
wristofdoom
Top-Tier Member

Posts: 347
Joined: 09/03/2020

I created a command for Microsoft Excel (most recent version, Microsoft 365) based on a macro recording.


The command is select all cells (clicking the triangle in the upper left corner), and then apply "auto fit column"  ( Home > Format > auto fit column width )


In Excel, the macro generated by performing these actions with the mouse is:


    Cells.Select

    Selection.Columns.AutoFit


Seems straightforward enough. I put this into a command called "auto fit column":


Sub Main

    Cells.Select

    Selection.Columns.AutoFit

End Sub


I added the Excel document object library by pressing ALT+ENTER.


But when I execute the command, I get the following error message from Dragon:


"The macro contains the error:


MyCommand: "auto fit column"

line: 3 

position: 0

Description: (1004) Application specific error. - Invalid flags."


Any ideas?


 



-------------------------

Dragon Professional Individual v15.6. Windows 10. Knowbrainer 2017.

Statistics
32617 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 1 users logged in.
The most users ever online was 12124 on 09/09/2020 at 04:59 AM.
There are currently 94 guests browsing this forum, which makes a total of 95 users using this forum.

FuseTalk Standard Edition v4.0 - © 1999-2023 FuseTalk™ Inc. All rights reserved.