-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUnicodeToVBAPrompt.frm
54 lines (43 loc) · 1.58 KB
/
UnicodeToVBAPrompt.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} UnicodeToVBAPrompt
Caption = "Unicode Encoder for VBA"
ClientHeight = 3225
ClientLeft = 120
ClientTop = 465
ClientWidth = 9690.001
OleObjectBlob = "UnicodeToVBAPrompt.frx":0000
StartUpPosition = 1 'CenterOwner
End
Attribute VB_Name = "UnicodeToVBAPrompt"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'@Folder("VBAProgrammingTools")
Option Explicit
Private Sub btnCancel_Click()
Hide
Unload Me
End Sub
Private Sub btnInsert_Click()
Hide
Dim vbaCode As String
vbaCode = ProgrammingTools.ConvertUnicodeTextToVBACode(tbxInput.Value)
Unload Me
Dim pane As CodePane
Dim codeMod As CodeModule
Set pane = Application.VBE.ActiveCodePane
Set codeMod = pane.CodeModule
Dim startLine As Long, startCol As Long, endLine As Long, endCol As Long
pane.GetSelection startLine, startCol, endLine, endCol
Dim textBeforeSelection As String, textAfterSelection As String
textBeforeSelection = Left$(codeMod.Lines(startLine, 1), startCol - 1)
textAfterSelection = Mid$(codeMod.Lines(endLine, 1), endCol + 1)
codeMod.DeleteLines startLine, endLine - startLine + 1
codeMod.InsertLines startLine, textBeforeSelection & vbaCode & textAfterSelection
Application.VBE.ActiveCodePane.Show
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Unload Me
Application.VBE.ActiveCodePane.Show
End Sub