如何将字符串转换为范围[WORD VBA]

时间:2016-01-04 08:47:40

标签: vba ms-word word-vba

如何将字符串转换为临时范围,以便我们可以获取范围对象的功能以使用字符串。 例如,我正在做这样的事情。

修改

我有单词表格单元格2

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  mysql-server-5.5
Suggested packages:
  tinyca mailx
The following NEW packages will be installed:
  mysql-server-5.5
0 upgraded, 1 newly installed, 0 to remove and 60 not upgraded.
1 not fully installed or removed.
Need to get 0 B/1981 kB of archives.
After this operation, 32.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Preconfiguring packages ...
(Reading database ... 95180 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.5_5.5.46-0ubuntu0.14.04.2_amd64.deb ...
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Aborting downgrade from (at least) 5.6 to 5.5.
If are sure you want to downgrade to 5.5, remove the file
/var/lib/mysql/debian-*.flag and try installing again.
dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.5_5.5.46-0ubuntu0.14.04.2_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.5_5.5.46-0ubuntu0.14.04.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

这个宏不起作用,所以我不能说天气,这是对的或错误的做法。这只是一个想法。 是否可以调暗温度? 我的问题有更好的选择吗?

1 个答案:

答案 0 :(得分:0)

我知道这是存根,但这是适合我的代码。

StrTxt = oHtml.body.innerText
                            'MsgBox StrTxt
                            Set docnew = Documents.Add
                                With docnew
                                    .Range.Text = StrTxt
                                    Set drange = ActiveDocument.Range( _
                                        Start:=ActiveDocument.Paragraphs(1).Range.Start, _
                                        End:=ActiveDocument.Paragraphs(150).Range.End)
                                        drange.Delete
                                        Set Rng1 = ActiveDocument.Range
                                            If Rng1.Find.Execute(findText:="Abstract") Then
                                                Set rng2 = ActiveDocument.Range(Rng1.End, ActiveDocument.Range.End)
                                                If rng2.Find.Execute(findText:=".") Then
                                                    strTheText = ActiveDocument.Range(Rng1.End, rng2.Start).Text
                                                    strTheText = Replace(strTheText, ":  ", ":")
                                                    'MsgBox strTheText
                                                End If
                                            End If
                                              .Close (Word.WdSaveOptions.wdDoNotSaveChanges)
                                End With
                            Set docnew = Nothing
                            Application.ScreenUpdating = False
                        End If
                            With Tbl.Cell(i, 3).Range
                            .InsertAfter vbCr & "Abstract" & strTheText & "."
                            End With