国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
在Word中用VBA寫(xiě)的輔助打印彩色VB代碼的小程序

由于最近開(kāi)發(fā)軟件的過(guò)程中需要打印VB的代碼,但當(dāng)代碼很多時(shí)感覺(jué)打印出來(lái)的黑黑的滿篇子不如在編輯器里看那彩色的代碼省力,在網(wǎng)上找了半天也沒(méi)找到合適的工具來(lái)解決這個(gè)問(wèn)題,看來(lái)想偷懶是不行了,于是就用Word編了一個(gè)小程序,算法不優(yōu),速度也不快,不過(guò)總比手動(dòng)強(qiáng)多了0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" src="http://blog.hexun.com//CuteSoft_Client/CuteEditor/images/emwink.gif" src_cetemp="http://blog.hexun.com//CuteSoft_Client/CuteEditor/images/emwink.gif" align="absMiddle" border="0">,以后在網(wǎng)上發(fā)代碼也可以是彩色的了,下面就是用這段代碼就是程序格式化后的效果。下載后將兩個(gè)文件導(dǎo)入到Word的VBA中,然后第一次使用前先運(yùn)行宏“ShowFormatSet”做好相關(guān)設(shè)置,再運(yùn)行宏“FormatVBCode”就能將復(fù)制到word中的VB代碼格式化好了。說(shuō)明:最終格式化結(jié)果可能和vb編輯器略有不同。

Dim EditChanged As Boolean, CurrRow As Integer, CurrCol As Integer, EditState As Boolean

 

Private Sub Command1_Click()

    '設(shè)置單元格A1的格式為"K0+000.00"

    Sheet("A1").FormatString = "K0+000.00": Call Calculate

End Sub

 

Private Sub Form_Load()

    Dim I As Integer, J As Integer

    Me.Caption = "模擬Excel計(jì)算表格"

    CreateTableHead 100 '生成表頭

    With Text2

        .Appearance = 0

        .Visible = False: EditChanged = False

        .Font.Size = 11

    End With

    With MSHFlexGrid1

        Frame1.Caption = "單元格" & .TextMatrix(0, 1) & .TextMatrix(1, 0) & "的公式"

        '初始化表格對(duì)象

        For J = 1 To .Rows - 1

            For I = 1 To .Cols - 1

                          '單元格地址用A1形式表示,公式,單元格格式,單元格文本,,,索引關(guān)鍵字

                Sheet.Add .TextMatrix(0, I) & J, "", "", "", J, I, .TextMatrix(0, I) & J

            Next

        Next

    End With

   

End Sub

Private Sub CreateTableHead(R As Integer)

    With MSHFlexGrid1

        .Cols = 20

        .Rows = 20

        .Font.Size = 12

        .AllowUserResizing = flexResizeBoth

        s$ = " |"

        For J = 65 To 90

            s$ = s$ & Chr(J) & "|"

        Next

        s$ = Left(s$, Len(s$) - 1)

        s$ = s$ & ";|"

        For J = 1 To R

            s$ = s$ & J & "|"

        Next

        .FormatString = Left(s$, Len(s$) - 1)

        For J = 1 To 26

            .ColWidth(J) = 1000

        Next

    End With

End Sub

 

Private Sub Label1_Click()

'打開(kāi)某個(gè)網(wǎng)址

'ShellExecute Me.hwnd, "open", "http://dongxingsofthome.blog.hexun.com/", vbNullString, vbNullString, vbNormalFocus

Shell "C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE http://dongxingsofthome.blog.hexun.com/8341928_d.html", vbMaximizedFocus

'給某個(gè)信箱發(fā)電子郵件

'ShellExecute hWnd, "open", "mailto:sst95@21cn.com", vbNullString, vbNullString, 0

 

End Sub

 

Private Sub MSHFlexGrid1_DblClick()

    If MSHFlexGrid1.Text <> "" Then

        EditState = True

    Else

        EditState = False

    End If

    With MSHFlexGrid1

        Text2.Text = Sheet(.TextMatrix(0, .Col) & .Row).Formula

    End With

    Text2.Visible = True

    With MSHFlexGrid1

        Text2.Top = .CellTop + 2010

        Text2.Left = .CellLeft + 90

        Text2.Height = .CellHeight - 20

        Text2.Width = .CellWidth + 30

        Text2.SetFocus

    End With

End Sub

 

Private Sub MSHFlexGrid1_KeyDown(KeyCode As Integer, Shift As Integer)

 

    If KeyCode = 229 Then

        Text2.Text = ""

    ElseIf KeyCode <> 37 And KeyCode <> 38 And KeyCode <> 39 And KeyCode <> 40 Then

        Text2.Text = ""

    End If

    If KeyCode = 46 Then '處理Delete

        Text1.Text = ""

        With MSHFlexGrid1

            For J = .Row To .RowSel

                For I = .Col To .ColSel

                    .TextMatrix(J, I) = ""

                    Sheet.Item(.TextMatrix(0, I) & J).Formula = ""

                Next

            Next

        End With

    End If

End Sub

 

Private Sub MSHFlexGrid1_KeyPress(KeyAscii As Integer)

 

    If KeyAscii < 255 And KeyAscii <> 27 And KeyAscii <> 8 Then

        If Chr(KeyAscii) = "=" Then

            Text2.Text = ""

        End If

        Text2.Text = Text2.Text & Chr(KeyAscii)

    End If

    If KeyAscii = 8 Then 'back

        Text2.Text = ""

    End If

    If KeyAscii <> 27 And KeyAscii <> 13 Then

        Text2.SelStart = Len(Text2.Text)

        Text2.Visible = True

        With MSHFlexGrid1

            Text2.Top = .CellTop + 2010

            Text2.Left = .CellLeft + 90

            Text2.Height = .CellHeight - 20

            Text2.Width = .CellWidth + 30

            Text2.SetFocus

        End With

    End If

    If KeyAscii = 13 Then

        MSHFlexGrid1.Row = MSHFlexGrid1.Row + 1: EditChanged = False

        With MSHFlexGrid1

            Frame1.Caption = "單元格" & .TextMatrix(0, .Col) & .TextMatrix(.Row, 0) & "的公式"

            Text1.Text = Sheet.Item(MSHFlexGrid1.TextMatrix(0, MSHFlexGrid1.Col) & MSHFlexGrid1.Row).Formula

        End With

    End If

End Sub

 

Private Sub MSHFlexGrid1_RowColChange()

    If EditChanged = True Then

        With MSHFlexGrid1

            .TextMatrix(CurrRow, CurrCol) = Text2.Text

            Sheet.Item(.TextMatrix(0, CurrCol) & CurrRow).Formula = Text2.Text

        End With

        Call Calculate

    End If

    Text2.Visible = False: EditChanged = False

    Text1.Text = Sheet.Item(MSHFlexGrid1.TextMatrix(0, MSHFlexGrid1.Col) & MSHFlexGrid1.Row).Formula

End Sub

 

Private Sub MSHFlexGrid1_SelChange()

    With MSHFlexGrid1

        Frame1.Caption = "單元格" & .TextMatrix(0, .Col) & .TextMatrix(.Row, 0) & "的公式"

        '在公式欄內(nèi)顯示單元格的公式

        Text1.Text = Sheet.Item(MSHFlexGrid1.TextMatrix(0, MSHFlexGrid1.Col) & MSHFlexGrid1.Row).Formula

    End With

End Sub

 

Private Sub Text2_Change()

    EditChanged = True

    CurrRow = MSHFlexGrid1.Row

    CurrCol = MSHFlexGrid1.Col

End Sub

 

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)

    Select Case KeyCode '處理光標(biāo)鍵

        Case 37, 38, 39, 40

            If EditState = False Then

                Call SetCellContent(Text2.Text)

                Text2.Visible = False

                If KeyCode = 40 Then

                    MSHFlexGrid1.Row = MSHFlexGrid1.Row + 1

                ElseIf KeyCode = 37 Then

                    MSHFlexGrid1.Col = MSHFlexGrid1.Col - 1

                ElseIf KeyCode = 39 Then

                    MSHFlexGrid1.Col = MSHFlexGrid1.Col + 1

                ElseIf KeyCode = 38 Then

                    MSHFlexGrid1.Row = MSHFlexGrid1.Row - 1

                End If

            End If

            EditState = False

            MSHFlexGrid1.SetFocus

    End Select

End Sub

 

Private Sub Text2_KeyPress(KeyAscii As Integer)

    Select Case KeyAscii

        Case 13 '處理回車(chē)鍵Enter

                Call SetCellContent(Text2.Text)

                Text2.Visible = False

                MSHFlexGrid1.Row = MSHFlexGrid1.Row + 1

                MSHFlexGrid1.SetFocus

                EditState = False

                EditChanged = False

            MSHFlexGrid1.SetFocus

        Case 27 '處理ESC

            Text2.Visible = False

            MSHFlexGrid1.SetFocus

            EditChanged = False

    End Select

End Sub

 

0 && image.height>0){if(image.width>=700){this.width=700;this.height=image.height*700/image.width;}}" alt="查看更多精彩圖片" src="http://photo5.hexun.com/p/2007/0321/84313/b_F54E8D9A59F01B29A80CDDBFF8084ABC.jpg" src_cetemp="http://photo5.hexun.com/p/2007/0321/84313/b_F54E8D9A59F01B29A80CDDBFF8084ABC.jpg" border="0">點(diǎn)此下載

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
VB MSFlexGrid控件的幾種簡(jiǎn)單的使用方法
不要textbox令MshflexGrid有編輯功能
vb中msflexgrid的使用舉例
VB與ADO的用法 (增刪改查)
MSHFLEXGRID控件講座(2).網(wǎng)格的編輯,保存與加載 VB / 控件 - CSDN...
為MSHFlexGrid添加表格編輯功能
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服