vbscript VBA Excel将Excel表格转换为JIRA Wiki标记

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vbscript VBA Excel将Excel表格转换为JIRA Wiki标记相关的知识,希望对你有一定的参考价值。

Sub ConvertToJiraTable()
    Dim workingRange As Range, currCol As Range, currRow As Range
    Dim rowIndex As Long, colIndex As Long
    Dim output As String, cellVal As String, status As String
    Dim statusHash As Dictionary
    Dim cb As DataObject
    Set cb = New DataObject
    Set statusHash = New Dictionary
    statusHash("Done") = "(/)"
    statusHash("Not Done") = "(x)"
    statusHash("WIP") = "(i)"
    statusHash("Not Required") = "(!)"
    rowIndex = 1
    output = "||"
    Application.ScreenUpdating = False
    Set workingRange = Range("A1").CurrentRegion
    For Each currRow In workingRange.Rows
        colIndex = 1
        For Each currCol In currRow.Columns
            'replace empty value with space to generate the cell border
            cellVal = currCol.Value
            If (cellVal = "") Then cellVal = " "
            If rowIndex = 1 Then
                output = output & cellVal & "||"
            Else
                If colIndex = 1 Then
                    status = statusHash(cellVal)
                    If status = "" Then status = " "
                    output = output & "|" & status & "|"
                ElseIf colIndex > 1 Then
                    output = output & cellVal & "|"
                End If
            End If
            colIndex = colIndex + 1
        Next currCol
        rowIndex = rowIndex + 1
        output = output & vbCrLf
    Next currRow
    cb.SetText output
    cb.PutInClipboard
End Sub

以上是关于vbscript VBA Excel将Excel表格转换为JIRA Wiki标记的主要内容,如果未能解决你的问题,请参考以下文章

在VBScript文件中集成VBA

vbscript [Excel VBA中的时间戳]在Excel VBA #Excel VBA中创建时间戳字符串

vbscript VBA - Excel - Hack受保护的Excel文档或表格(VBA) - 代码

vbscript VBA EXCEL

vbscript vba excel公式相关

vbscript 行和列高度 - Excel(VBA)