• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor

    Reply
    Distinguished Contributor
    Posts: 565
    Registered: ‎02-12-2009

    Re: List of Shortcut Keys...

    10-05-2012 12:43 PM in reply to: tdswanson

    I'm in 2011 but it works fine as stated in my previous response (see attached file).

    Please use plain text.
    Valued Contributor
    Posts: 102
    Registered: ‎03-07-2012

    Re: List of Shortcut Keys...

    10-22-2012 10:34 AM in reply to: cadfish1

    Hmmm.  Well it won't import for me.  It shows up to be loaded.....  But it doesn't actually come in.  There are no new macros listed after I choose "open" in the open dialog box.

     

    Can you post a TXT file so I can create a new macro and paste it in?

     

    Thanks for your help......

    ********************************************************
    Inventor 2013 64-bit SP1.1, single user
    Win 7 Pro 64-bit SP1
    Please use plain text.
    Distinguished Contributor
    Posts: 565
    Registered: ‎02-12-2009

    Re: List of Shortcut Keys...

    10-22-2012 10:44 AM in reply to: tdswanson

    In Inventor > Tools > VBA Editor > in the VBA Editor > File > New Project > Expand UserProject1 > Expand Modules > double click on Module1 > paste in code (listed below) in window on the right > File > Save UserProject1

     

    Sub ShortCuts_ExportToExcel()
        Dim oControlDefinition As ControlDefinition
        Dim oExcelApp As Object     'Late binding - none version specific
        Dim oWorkBook As Object     'Late binding - none version specific
        Dim oWorkSheet As Object    'Late binding - none version specific
        Dim lRow As Long
        Dim bCustomCommand As Boolean
        Dim bBuiltIn_IsShortcutOverridden As Boolean
        Dim sLastColumn As String
        
        'Excel Constants
        Const xlSortOnValues As Long = 0
        Const xlAscending As Long = 1
        Const xlSortNormal As Long = 0
        Const xlYes As Long = 1
        Const xlTopToBottom As Long = 1
        Const xlPinYin As Long = 1
        Const xlDown As Long = -4121
        Const xlFormatFromLeftOrAbove As Long = 0
        Const xlPrintNoComments As Long = -4142
        Const xlPortrait As Long = 1
        Const xlPaperLetter As Long = 1
        Const xlAutomatic As Long = -4105
        Const xlDownThenOver As Long = 1
        Const xlPrintErrorsDisplayed As Long = 0
        Const xlEdgeBottom As Long = 9
        Const xlThin As Long = 2
        Const xlThick As Long = 4
        Const xlMedium As Long = -4138
        Const xlCenter As Long = -4108
        
        Set oExcelApp = CreateObject("Excel.Application")
        oExcelApp.Visible = True
        Set oWorkBook = oExcelApp.ActiveWorkbook
        If oWorkBook Is Nothing Then Set oWorkBook = oExcelApp.Workbooks.Add
        Set oWorkSheet = oWorkBook.ActiveSheet
        
        oWorkSheet.Cells.NumberFormat = "@"
        oWorkSheet.Rows("1:3").Font.Bold = True
        oWorkSheet.Range("A2").Font.Color = -16776961   'Red
        oWorkSheet.Range("A2").Value = "Header Setup..."
        With oWorkSheet.Range("A1")
            .Value = "Inventor " & _
                ThisApplication.SoftwareVersion.DisplayVersion & " Shortcuts"
            .Font.Size = 16
        End With
        
        oWorkSheet.Range("A3").Value = "Shortcut"
        oWorkSheet.Columns("A").ColumnWidth = 10
        oWorkSheet.Range("B3").Value = "Command Name"
        oWorkSheet.Columns("B").ColumnWidth = 30
        oWorkSheet.Range("C3").Value = "Description"
        oWorkSheet.Columns("C").ColumnWidth = 60
        oWorkSheet.Range("A4").Select
        oExcelApp.ActiveWindow.FreezePanes = True
        oWorkSheet.Rows("3").Borders(xlEdgeBottom).Weight = xlMedium
        
        oWorkSheet.Range("A2").Value = "Page Setup..."
        With oWorkSheet.PageSetup
            oWorkSheet.Range("A2").Value = "Page Setup:  CenterHeader"
            .CenterHeader = Replace( _
                "&""-,Bold""&20Inventor Shortcuts&""-,Regular""  &12(Page &P of &N)", _
                "Inventor", "Inventor " & ThisApplication.SoftwareVersion.DisplayVersion)
            oWorkSheet.Range("A2").Value = "Page Setup:  LeftMargin"
            .LeftMargin = oExcelApp.InchesToPoints(0.25)
            oWorkSheet.Range("A2").Value = "Page Setup:  RightMargin"
            .RightMargin = oExcelApp.InchesToPoints(0.25)
            oWorkSheet.Range("A2").Value = "Page Setup:  TopMargin"
            .TopMargin = oExcelApp.InchesToPoints(0.4)
            oWorkSheet.Range("A2").Value = "Page Setup:  BottomMargin"
            .BottomMargin = oExcelApp.InchesToPoints(0.25)
            oWorkSheet.Range("A2").Value = "Page Setup:  HeaderMargin"
            .HeaderMargin = oExcelApp.InchesToPoints(0#)
            oWorkSheet.Range("A2").Value = "Page Setup:  FooterMargin"
            .FooterMargin = oExcelApp.InchesToPoints(0#)
            oWorkSheet.Range("A2").Value = "Page Setup:  PrintTitleRows"
            .PrintTitleRows = "$3:$3"
            oWorkSheet.Range("A2").Value = "Page Setup:  PrintGridlines"
            .PrintGridlines = True
            oWorkSheet.Range("A2").Value = "Page Setup:  CenterHorizontally"
            .CenterHorizontally = False
            oWorkSheet.Range("A2").Value = "Page Setup:  CenterVertically"
            .CenterVertically = False
            oWorkSheet.Range("A2").Value = "Page Setup:  Orientation"
            .Orientation = xlPortrait
            oWorkSheet.Range("A2").Value = "Page Setup:  PaperSize"
            .PaperSize = xlPaperLetter
            oWorkSheet.Range("A2").Value = "Page Setup:  FirstPageNumber"
            .FirstPageNumber = xlAutomatic
            oWorkSheet.Range("A2").Value = "Page Setup:  Order"
            .Order = xlDownThenOver
            oWorkSheet.Range("A2").Value = "Page Setup:  Zoom"
            .Zoom = False
            oWorkSheet.Range("A2").Value = "Page Setup:  FitToPagesWide"
            .FitToPagesWide = 1
            oWorkSheet.Range("A2").Value = "Page Setup:  FitToPagesTall"
            .FitToPagesTall = 100
        End With
        
        sLastColumn = "C"
        lRow = 3
        For Each oControlDefinition In ThisApplication.CommandManager.ControlDefinitions
            If oControlDefinition.DefaultShortcut <> "" Or _
                oControlDefinition.OverrideShortcut <> "" Then
                
                lRow = lRow + 1
                oWorkSheet.Range("A2").Value = "Populating Row: " & lRow
                If oControlDefinition.BuiltIn Then
                    If oControlDefinition.IsShortcutOverridden Then
                        oWorkSheet.Range("A" & lRow).Value = oControlDefinition.OverrideShortcut
                        bBuiltIn_IsShortcutOverridden = True
                        oWorkSheet.Range("E" & lRow).Value = oControlDefinition.DefaultShortcut
                    Else
                        oWorkSheet.Range("A" & lRow).Value = oControlDefinition.DefaultShortcut
                    End If
                Else
                    oWorkSheet.Rows(lRow).Font.Color = -4165632
                    oWorkSheet.Range("A" & lRow).Value = oControlDefinition.OverrideShortcut
                    bCustomCommand = True
                    oWorkSheet.Range("D" & lRow).Value = "True"
                End If
                
                oWorkSheet.Range("B" & lRow).Value = _
                    Replace(oControlDefinition.DisplayName, "&", "")
                oWorkSheet.Range("C" & lRow).Value = _
                    Replace(oControlDefinition.DescriptionText, "&", "")
            End If
        Next
        If bCustomCommand Or bBuiltIn_IsShortcutOverridden Then
            'bBuiltIn_IsShortcutOverridden is used here to ensure there will be no column gap
            oWorkSheet.Range("D3").Value = "Custom Command?"
            sLastColumn = "D"
        End If
        If bBuiltIn_IsShortcutOverridden Then
            oWorkSheet.Range("E3").Value = "Default Shortcut (Overwritten)"
            sLastColumn = "E"
        End If
        
        With oWorkSheet.Range("A1:" & sLastColumn & "1")
            .HorizontalAlignment = xlCenter
            .MergeCells = True
        End With
        
        oWorkSheet.Range("A2").Value = "AutoFit Columns"
        oWorkSheet.Columns("A:" & sLastColumn).EntireColumn.AutoFit
        
        oWorkSheet.Range("A2").Value = "Sort"
        oWorkSheet.Sort.SortFields.Clear
        oWorkSheet.Sort.SortFields.Add Key:=oWorkSheet.Range("A4:A" & lRow) _
            , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
        With oWorkSheet.Sort
            .SetRange oWorkSheet.Range("A4:" & sLastColumn & lRow)
            .Header = xlYes
            .MatchCase = False
            .Orientation = xlTopToBottom
            .SortMethod = xlPinYin
            .Apply
        End With
        
        oWorkSheet.Range("A2").Value = "PageSetup:  PrintArea"
        oWorkSheet.PageSetup.PrintArea = "$A$4:$" & sLastColumn & "$" & lRow
        oWorkSheet.Range("A2").Value = ""
    End Sub

     

    Please use plain text.
    Valued Contributor
    Posts: 102
    Registered: ‎03-07-2012

    Re: List of Shortcut Keys...

    10-22-2012 10:54 AM in reply to: cadfish1

    Worked out great, came right in.  An excellent utility to have, thanks a bunch for your help!

    ********************************************************
    Inventor 2013 64-bit SP1.1, single user
    Win 7 Pro 64-bit SP1
    Please use plain text.