Skip to content

Commit b94d14c

Browse files
tduguidtduguid
tduguid
authored and
tduguid
committed
#15 Add keytips to VB.NET version
1 parent efe7ad1 commit b94d14c

File tree

2 files changed

+103
-12
lines changed

2 files changed

+103
-12
lines changed

VB/Ribbon.xml

+62-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
33

4-
<!--
4+
<!--
55
Use the following tags to remove indivdual ribbons when this loads
66
<tab idMso="TabHome" getVisible="GetVisible"/>
77
<tab idMso="TabInsert" getVisible="GetVisible"/>
@@ -20,18 +20,22 @@ Or use the following tag to remove all other ribbons when this loads
2020

2121
<ribbon>
2222
<tabs>
23-
<tab
24-
id="tabScriptHelp"
25-
getLabel="GetLabelText"
23+
<tab
24+
id="tabScriptHelp"
25+
getLabel="GetLabelText"
2626
insertAfterMso="TabHome"
27+
keytip="SH"
2728
>
2829
<group
2930
id="grpClipboard"
3031
label="Clipboard"
31-
imageMso="Copy">
32-
<control
33-
idMso="PasteMenu"
34-
size="large"
32+
imageMso="Copy"
33+
getVisible="GetVisible"
34+
>
35+
<control
36+
idMso="PasteMenu"
37+
size="large"
38+
keytip="V"
3539
/>
3640
<button
3741
id="btnCopyVisibleCells"
@@ -42,6 +46,7 @@ Or use the following tag to remove all other ribbons when this loads
4246
size="large"
4347
screentip="Copy Visible Cells"
4448
supertip="Copies only visible cells from a selection"
49+
keytip="CVC"
4550
/>
4651
</group>
4752
<group
@@ -62,14 +67,17 @@ Or use the following tag to remove all other ribbons when this loads
6267
<gallery
6368
idMso="FormatAsTableGallery"
6469
size="large"
70+
keytip="FAT"
6571
/>
6672
<gallery
6773
idMso="ViewFreezePanesGallery"
6874
size="large"
75+
keytip="VFP"
6976
/>
7077
<button
7178
idMso="RemoveDuplicates"
7279
size="large"
80+
keytip="DUP"
7381
/>
7482
</group>
7583
<group
@@ -85,6 +93,7 @@ Or use the following tag to remove all other ribbons when this loads
8593
size="large"
8694
screentip="Clean Data"
8795
supertip="This feature removes all nonprintable characters from text and trims leading and trailing spaces."
96+
keytip="CLE"
8897
/>
8998
<button
9099
id="btnZeroToNull"
@@ -96,16 +105,29 @@ Or use the following tag to remove all other ribbons when this loads
96105
size="large"
97106
screentip="Convert to NULL"
98107
supertip="Replaces the zero string values with 'NULL'"
108+
keytip="NUL"
99109
/>
100110
<button
101111
id="btnFormatDateColumns"
102112
label="Format Date Columns"
103113
onAction="OnAction"
104114
getEnabled="GetEnabled"
105-
imageMso="DateAndTimeInsert"
115+
imageMso="NewAppointment"
106116
size="large"
107117
screentip="Format Date Columns"
108-
supertip="Update the default date format of the cell"
118+
supertip="Update the default date format of any column that has a date without a zero string value"
119+
keytip="DTE"
120+
/>
121+
<button
122+
id="btnFormatTimeColumns"
123+
label="Format Time Columns"
124+
onAction="OnAction"
125+
getEnabled="GetEnabled"
126+
imageMso="DateAndTimeInsert"
127+
size="large"
128+
screentip="Format Time Columns"
129+
supertip="Update the default time format of the selected column"
130+
keytip="TIM"
109131
/>
110132
<button
111133
id="btnClearInteriorColor"
@@ -117,6 +139,7 @@ Or use the following tag to remove all other ribbons when this loads
117139
size="large"
118140
screentip="Clear Interior Color"
119141
supertip="Clear the interior color of cells in the current table"
142+
keytip="INT"
120143
/>
121144
<button
122145
id="btnSeparateValues"
@@ -127,6 +150,7 @@ Or use the following tag to remove all other ribbons when this loads
127150
size="large"
128151
screentip="Separate Values"
129152
supertip="Separate values into new rows from the selected column by a delimited string value setting"
153+
keytip="SPR"
130154
/>
131155
<menu
132156
id="mnuScriptType"
@@ -135,6 +159,7 @@ Or use the following tag to remove all other ribbons when this loads
135159
size="large"
136160
screentip="Add Script Column"
137161
supertip="The selected button will change the script string format."
162+
keytip="ADD"
138163
>
139164
<button
140165
id="btnScriptTypeTSqlCreateTable"
@@ -342,6 +367,7 @@ Or use the following tag to remove all other ribbons when this loads
342367
id="grpScriptVariables"
343368
label="Script Variables"
344369
imageMso="ShowFormulas"
370+
getVisible="GetVisible"
345371
>
346372
<comboBox
347373
id="cboTableAlias"
@@ -353,6 +379,7 @@ Or use the following tag to remove all other ribbons when this loads
353379
sizeString= "XXXXXXXXXXXXXXXXXXXX"
354380
screentip="Table Alias"
355381
supertip="This is the table alias used as a prefix in the header and footer row in the script column."
382+
keytip="DTA"
356383
/>
357384
<comboBox
358385
id="cboDateFormatFind"
@@ -364,6 +391,7 @@ Or use the following tag to remove all other ribbons when this loads
364391
sizeString= "XXXXXXXXXXXXXXXXXXXX"
365392
screentip="Find Date Format"
366393
supertip="This is the date format to find. It defaults to the format from SQL Server Management Studio after you paste records into Excel."
394+
keytip="DFF"
367395
/>
368396
<comboBox
369397
id="cboDateFormatReplace"
@@ -375,6 +403,7 @@ Or use the following tag to remove all other ribbons when this loads
375403
sizeString= "XXXXXXXXXXXXXXXXXXXX"
376404
screentip="Replace Date Format"
377405
supertip="This is the date format the script uses to replace the formatting for date columns."
406+
keytip="DFR"
378407
/>
379408
<button
380409
id="btnTableAlias"
@@ -383,6 +412,7 @@ Or use the following tag to remove all other ribbons when this loads
383412
screentip="Open Table Alias List"
384413
supertip="This will open the table alias list form."
385414
tag="TableAlias"
415+
keytip="LTA"
386416
/>
387417
<button
388418
id="btnDateFormatFind"
@@ -391,6 +421,7 @@ Or use the following tag to remove all other ribbons when this loads
391421
screentip="Open Date Format List"
392422
supertip="This will open the date format list form."
393423
tag="DateFormat"
424+
keytip="LFF"
394425
/>
395426
<button
396427
id="btnDateFormatReplace"
@@ -399,6 +430,7 @@ Or use the following tag to remove all other ribbons when this loads
399430
screentip="Open Date Format List"
400431
supertip="This will open the date format list form."
401432
tag="DateFormat"
433+
keytip="LFR"
402434
/>
403435
</group>
404436
<group
@@ -413,6 +445,7 @@ Or use the following tag to remove all other ribbons when this loads
413445
size="large"
414446
screentip="Add-In Settings Form"
415447
supertip="This opens a user form with a list of custom properties stored in the file."
448+
keytip="SET"
416449
/>
417450
<button
418451
id="btnFileList"
@@ -423,6 +456,7 @@ Or use the following tag to remove all other ribbons when this loads
423456
size="large"
424457
screentip="Create A File Listing"
425458
supertip="This will create a file listing of the user selected path recursively. It will save the .csv and .bat file in the root folder selected."
459+
keytip="LST"
426460
/>
427461
<button
428462
idMso="ComAddInsDialog"
@@ -442,6 +476,7 @@ Or use the following tag to remove all other ribbons when this loads
442476
size="large"
443477
screentip="How To..."
444478
supertip="This opens the read me page in GitHub with detailed instructions of the Add-In functionality."
479+
keytip="HLP"
445480
/>
446481
<button
447482
id="btnOpenNewIssue"
@@ -451,11 +486,22 @@ Or use the following tag to remove all other ribbons when this loads
451486
size="large"
452487
screentip="Report An Issue"
453488
supertip="This will open a new issue page in GitHub. The user will need to login to raise an issue."
489+
keytip="RPT"
490+
/>
491+
<button
492+
id="btnDownloadNewVersion"
493+
label="New Version Is Available"
494+
onAction="OnAction"
495+
image="download"
496+
size="large"
497+
screentip="Download A New Version"
498+
supertip="This will download a copy of the file from GitHub."
499+
visible="false"
454500
/>
455501
<button
456502
id="btnHelpApi"
457503
label="API Doc... "
458-
onAction="OpenHelpApi"
504+
onAction="OnAction"
459505
imageMso="CategoryCollapse"
460506
size="normal"
461507
screentip="View API documentation for this product"
@@ -496,8 +542,12 @@ Or use the following tag to remove all other ribbons when this loads
496542
getLabel="GetLabelText"
497543
getEnabled="False"
498544
/>
545+
<button
546+
id="btnStart"
547+
onAction="OnAction"
548+
keytip="RUN"
549+
/>
499550
</group>
500-
501551
</tab>
502552
</tabs>
503553
</ribbon>

VB/Scripts/Ribbon.vb

+41
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ Namespace Scripts
285285
ZeroStringToNull()
286286
Case "btnFormatDateColumns"
287287
FormatDateColumns()
288+
Case "btnFormatTimeColumns"
289+
FormatTimeColumns()
288290
Case "btnClearInteriorColor"
289291
ClearInteriorColor()
290292
Case "btnSeparateValues"
@@ -619,6 +621,45 @@ Namespace Scripts
619621

620622
End Sub
621623

624+
Public Sub FormatTimeColumns()
625+
Dim tbl As Excel.ListObject = Nothing
626+
Dim cell As Excel.Range = Nothing
627+
Try
628+
If ErrorHandler.IsAvailable(True) = False Then
629+
Return
630+
End If
631+
ErrorHandler.CreateLogRecord()
632+
tbl = Globals.ThisAddIn.Application.ActiveCell.ListObject
633+
cell = Nothing
634+
Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
635+
For Each col As Excel.ListColumn In tbl.ListColumns
636+
cell = FirstNotNullCellInColumn(col.DataBodyRange)
637+
If ((cell IsNot Nothing)) Then
638+
If cell.NumberFormat.ToString() = My.Settings.Table_ColumnDateFormatFind Or ErrorHandler.IsDate(cell.Value) Then
639+
col.DataBodyRange.NumberFormat = My.Settings.Table_ColumnDateFormatReplace
640+
col.DataBodyRange.HorizontalAlignment = Excel.Constants.xlCenter
641+
End If
642+
End If
643+
Next
644+
645+
Catch ex As System.Runtime.InteropServices.COMException
646+
ErrorHandler.DisplayMessage(ex)
647+
648+
Catch ex As Exception
649+
ErrorHandler.DisplayMessage(ex)
650+
651+
Finally
652+
Cursor.Current = System.Windows.Forms.Cursors.Arrow
653+
If tbl IsNot Nothing Then
654+
'Marshal.ReleaseComObject(tbl)
655+
End If
656+
If cell IsNot Nothing Then
657+
'Marshal.ReleaseComObject(cell)
658+
End If
659+
End Try
660+
661+
End Sub
662+
622663
Public Sub FormatAsTable()
623664
Dim range As Excel.Range = Nothing
624665
Dim tableName As String = My.Application.Info.Title + " " + DateTime.Now.ToString("yyyy-MM-ddThh:mm:ss:fffzzz")

0 commit comments

Comments
 (0)