Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trunk r1815 with some changes
- Loading branch information
0 parents
commit 67a9f6d
Showing
13 changed files
with
1,872 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# excel-regex-colorize | ||
|
||
Colorize string by regex | ||
|
||
## Usage | ||
|
||
See demo. | ||
|
||
## Install | ||
|
||
Use `bin\excel-regex-colorize-installer.xls` to nstall and uninstall. | ||
|
||
## Development | ||
|
||
# Decombine macro files to src/* | ||
$ cscript //nologo vbac.wsf decombine | ||
|
||
# Edit macro files | ||
$ vim src\excel-regex-colorize.xla\regex_colorize.bas | ||
|
||
# Combine macro files | ||
$ cscript //nologo vbac.wsf combine | ||
|
||
# Commit your changes | ||
$ git --all . | ||
|
||
### Requirement | ||
|
||
* [vbac.wsf](https://github.com/vbaidiot/Ariawase) | ||
|
||
## Licence | ||
|
||
[MIT](http://opensource.org/licenses/mit-license.php) | ||
|
||
## Author | ||
|
||
[sago35](https://github.com/sago35) |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
END | ||
Attribute VB_Name = "Sheet1" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = False | ||
Attribute VB_PredeclaredId = True | ||
Attribute VB_Exposed = True | ||
Option Explicit | ||
|
||
Private Const MSADDIN_PATH = "Microsoft\AddIns" | ||
Private Const AddinName = "excel-regex-colorize" | ||
|
||
Sub AddinInstall() | ||
|
||
Dim BookName As String | ||
Dim BookPath As String | ||
Dim AddinFile As String | ||
Dim SrcAddinFile As String | ||
Dim DistAddinFile As String | ||
|
||
BookName = ThisWorkbook.Name | ||
AddinFile = AddinName & ".xla" | ||
|
||
BookPath = ThisWorkbook.Path | ||
SrcAddinFile = BookPath & "\" & AddinFile | ||
|
||
If Dir(SrcAddinFile) = "" Then | ||
MsgBox "Addin file is not found." & vbCrLf & SrcAddinFile, vbCritical | ||
Exit Sub | ||
End If | ||
|
||
DistAddinFile = Environ("APPDATA") & "\" & MSADDIN_PATH & "\" & AddinFile | ||
|
||
If Dir(DistAddinFile) <> "" Then | ||
AddIns(AddinName).Installed = False | ||
End If | ||
|
||
FileCopy SrcAddinFile, DistAddinFile | ||
AddIns(AddinName).Installed = True | ||
|
||
MsgBox "Installed" | ||
|
||
End Sub | ||
|
||
|
||
Sub AddinUnInstall() | ||
|
||
Dim BookName As String | ||
Dim AddinFile As String | ||
Dim DelAddinFile As String | ||
|
||
BookName = ThisWorkbook.Name | ||
AddinFile = AddinName & ".xla" | ||
|
||
DelAddinFile = Environ("APPDATA") & "\" & MSADDIN_PATH & "\" & AddinFile | ||
|
||
If Dir(DelAddinFile) <> "" Then | ||
AddIns(AddinName).Installed = False | ||
Kill DelAddinFile | ||
End If | ||
|
||
MsgBox "Uninstalled" | ||
|
||
End Sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
VERSION 1.0 CLASS | ||
BEGIN | ||
MultiUse = -1 'True | ||
END | ||
Attribute VB_Name = "ThisWorkbook" | ||
Attribute VB_GlobalNameSpace = False | ||
Attribute VB_Creatable = False | ||
Attribute VB_PredeclaredId = True | ||
Attribute VB_Exposed = True | ||
Option Explicit | ||
|
||
Private WithEvents sht As Worksheet | ||
Attribute sht.VB_VarHelpID = -1 | ||
Public shortcutkey As String | ||
Public MENU_TITLE As String | ||
Public ADDIN_BUTTON_NAME1 As String | ||
Public ADDIN_BUTTON_NAME2 As String | ||
|
||
'Workbook�N���� | ||
Private Sub Workbook_Open() | ||
|
||
Dim SettingFile As String | ||
Dim LoadInfo As SettingFileInfo | ||
Dim IntFlNo As Integer | ||
Dim buf | ||
|
||
SettingFile = Environ("APPDATA") & "\" & regex_colorize.MSADDIN_PATH_SETTING_FILE | ||
LoadInfo = regex_colorize.LoadSettingFile(SettingFile) | ||
|
||
'�V���[�g�J�b�g�L�[�̓o�^ | ||
shortcutkey = LoadInfo.shortcutkey | ||
|
||
If shortcutkey <> "" Then | ||
Application.OnKey "^" & shortcutkey, "regex_colorize.regex_highlight" | ||
End If | ||
|
||
End Sub | ||
|
||
'�A�h�C���C���X�g�[���� | ||
Private Sub Workbook_AddinInstall() | ||
On Error GoTo ErrHand | ||
Initialize | ||
|
||
Dim cbrCmd As CommandBar | ||
Dim cbcMenu As CommandBarControl | ||
|
||
'���j���[�p�̃I�u�W�F�N�g�����܂� | ||
Set cbrCmd = Application.CommandBars("Worksheet Menu Bar") | ||
|
||
'�쐬�ς݂ł����������폜���܂� | ||
'���݂��Ȃ��ƃG���[���o�܂����AOn Error�c�ʼn�����Ă��܂� | ||
cbrCmd.Controls(MENU_TITLE).Delete | ||
|
||
'���j���[��lj����A�\���ݒ肵�܂� | ||
Set cbcMenu = cbrCmd.Controls.Add(Type:=msoControlPopup) | ||
cbcMenu.Caption = MENU_TITLE | ||
|
||
'���j���[�̒��Ƀ{�^���u�{�^��1�v��lj����܂� | ||
With cbcMenu.Controls.Add(Type:=msoControlButton) | ||
.Caption = ADDIN_BUTTON_NAME1 | ||
'�A�C�R���̎�ނ�ԍ��Ŏw�� | ||
.FaceId = 1087 | ||
'���s����T�u���[�`�������w�� | ||
.OnAction = "regex_colorize.regex_highlight" | ||
End With | ||
|
||
'���j���[�̒��Ƀ{�^���u�{�^��2�v��lj����܂� | ||
With cbcMenu.Controls.Add(Type:=msoControlButton) | ||
.Caption = ADDIN_BUTTON_NAME2 | ||
'�A�C�R���̎�ނ�ԍ��Ŏw�� | ||
.FaceId = 2502 | ||
'���s����T�u���[�`�������w�� | ||
.OnAction = "regex_colorize.setting" | ||
End With | ||
|
||
Set cbrCmd = Nothing | ||
Set cbcMenu = Nothing | ||
|
||
Exit Sub | ||
|
||
ErrHand: | ||
|
||
Resume Next | ||
|
||
'�E�N���b�N���j���[�o�^ | ||
Dim Newb, currentControl, exists | ||
|
||
'�R���g���[���̒��g������ | ||
exists = 0 | ||
For Each currentControl In Application.CommandBars("Cell").Controls | ||
If (currentControl.Caption = "������F�t��") Then | ||
exists = 1 | ||
End If | ||
Next | ||
|
||
'������F�t�����Ȃ���Βlj� | ||
If (exists = 0) Then | ||
Set Newb = Application.CommandBars("Cell").Controls.Add() | ||
With Newb | ||
.Caption = "������F�t��" | ||
.OnAction = "regex_highlight" | ||
.BeginGroup = False | ||
End With | ||
End If | ||
|
||
|
||
End Sub | ||
|
||
|
||
'�A�h�C���C���A���X�g�[���� | ||
Private Sub Workbook_AddinUninstall() | ||
'�A�h�C���^�u���j���[ | ||
On Error Resume Next | ||
Initialize | ||
Application.CommandBars("Worksheet Menu Bar").Controls(MENU_TITLE).Delete 'for old version 1.0 | ||
Application.CommandBars("Worksheet Menu Bar").Controls(ADDIN_BUTTON_NAME1).Delete | ||
Application.CommandBars("Worksheet Menu Bar").Controls(ADDIN_BUTTON_NAME2).Delete | ||
|
||
Dim currentControl, exists | ||
Dim SettingFile As String | ||
|
||
'�R���g���[���̒��g������ | ||
exists = 0 | ||
For Each currentControl In Application.CommandBars("Cell").Controls | ||
If (currentControl.Caption = "������F�t��") Then | ||
exists = 1 | ||
End If | ||
Next | ||
|
||
'������F�t��������폜 | ||
If (exists = 1) Then | ||
Application.CommandBars("Cell").Controls("������F�t��").Delete | ||
End If | ||
|
||
'�ݒ�t�@�C�����폜 | ||
SettingFile = Environ("APPDATA") & "\" & regex_colorize.MSADDIN_PATH_SETTING_FILE | ||
|
||
If Dir(SettingFile) <> "" Then | ||
Kill SettingFile | ||
End If | ||
|
||
End Sub | ||
|
||
Private Sub Initialize() | ||
MENU_TITLE = "������F�t��" | ||
ADDIN_BUTTON_NAME1 = "�N��" | ||
ADDIN_BUTTON_NAME2 = "�ݒ�" | ||
End Sub | ||
|
||
'�A�N�e�B�u�ȃV�[�g�̃C�x���g������������ | ||
Sub set_sht() | ||
Set sht = Application.ActiveSheet | ||
End Sub | ||
|
||
|
||
'�A�N�e�B�u�ȃV�[�g�̃C�x���g�������֎~���� | ||
Sub reset_sht() | ||
Set sht = Nothing | ||
End Sub | ||
|
||
|
||
'�A�N�e�B�u�ȃV�[�g�̑I���Z���ύX�ŃC�x���g�������� | ||
Sub sht_SelectionChange(ByVal Target As Range) | ||
'��������&�����T�C�Y���X�V���� | ||
Call regex_colorize.SerchKeyWord | ||
End Sub |
Oops, something went wrong.