VB实现上下标

该博客介绍如何使用VB在Excel中实现上下标的处理。通过创建一个VB模块,利用Microsoft Office Interop Excel库,遍历并修改Excel工作表中特定格式的单元格内容,将包含上下标信息的字符串转换为实际的上标和下标效果。
摘要由CSDN通过智能技术生成

Module Module1

    Private suptable As Hashtable
    Private subtable As Hashtable

    Sub Main(ByVal Args() As String)
        implementSubAndSup(Args(0))
    End Sub

    Private Sub implementSubAndSup(ByVal excelName As String)
        If (excelName.Length > 0) Then
            Dim excelApp As Microsoft.Office.Interop.Excel.Application
            Dim excelBook As Microsoft.Office.Interop.Excel.Workbook
            Dim excelsheet As Microsoft.Office.Interop.Excel.Worksheet '定义工作表类

            Try
                excelBook = New Microsoft.Office.Interop.Excel.Workbook()
            Catch ex As Exception

            End Try

            excelApp = CreateObject("Excel.Application")
            excelApp.DisplayAlerts = False
            Try
                excelBook = excelApp.Workbooks.Open(excelName)
            Catch ex As Exception
                '  System.Console.WriteLine("excelBook......." + ex.Message)
            End Try
            excelApp.Visible = False

            Dim m As Integer
            Dim sheetCount As Integer
            Try
                sheetCount = excelBook.Worksheets.Count
            Catch ex As Exception

            End Try

            If (sheetCount > 0) Then
                For m = 1 To sheetCount
                    Try
                        excelsheet = New Microsoft.Office.Interop.Excel.Worksheet()
                    Catch ex As Exception

                    End Try

                    Try
                        excelsheet = excelBook.Worksheets(m)
                        excelsheet.Select()
                    Catch ex As Exception
                        '    System.Console.WriteLi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值