在从右到左的MS-Word文档中将格式化的数字作为文本插入 [英] Inserting formatted numbers as text in Right to Left MS-Word document

查看:107
本文介绍了在从右到左的MS-Word文档中将格式化的数字作为文本插入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有sValA = 10/140/000字符串.

需要在从右至左文档中插入 10/140/000 作为文本.

Need inserting 10/140/000 as text in a right-to-left document.

当我在下面表演时

ThisDocument.Bookmarks("Temp_GrandTotal").Range.Text = sValA

它返回 000/140/10

任何帮助都将受到赞赏.

Any helps are appreciated.

推荐答案

您可以添加UDF以通过交换字符交换零件.然后像这样称呼它:

You can add a UDF to swap the parts by a swap character. Then call it like:

ThisDocument.Bookmarks("Temp_GrandTotal").Range.Text = SwapParts(sValA,"\")

UDF代码:

Option Explicit

Function SwapParts(ByVal sText As String, ByVal SwapChar As String) As String
    Dim oItems As Variant, oItem As Variant, sOutput As String
    oItems = Split(sText, SwapChar)
    For Each oItem In oItems
        If Len(sOutput) > 0 Then sOutput = SwapChar & sOutput
        sOutput = oItem & sOutput
    Next oItem
    SwapParts = sOutput
End Function

这篇关于在从右到左的MS-Word文档中将格式化的数字作为文本插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆