vb操作word表格,在指定单元格中指定起始位置和终止位置之间的字符设置下划线的问题
如在第三行,第三列,第六个字符与第十个之间字符设置下划线
Set wordapp = CreateObject("Word.Application")
Set worddoc = wordapp.Documents.Open(App.Path & "\1.doc")
wordapp.Visible = True
worddoc.Tables(1).Cell(3, 3).Range(6,10).Font.Underline = wdUnderlineSingle老是提示有错,不知为何?请高手赐教!

解决方案 »

  1.   

    在Word2003中开始记录宏,手动完成所需功能,结束记录宏,按Alt+F11键,查看刚才记录的宏对应的VBA代码。
      

  2.   

    TX Text Control 17.0 SP1 ,,用這個,,
      

  3.   

    Sub Macro2()
    '
    ' Macro2 Macro
    ' 宏在 2012-05-31 由 [email protected] 录制
    '
        Selection.MoveDown Unit:=wdLine, Count:=3
        Selection.MoveRight Unit:=wdCharacter, Count:=8
        Selection.MoveRight Unit:=wdCharacter, Count:=5, Extend:=wdExtend
        Selection.Font.UnderlineColor = wdColorAutomatic
        Selection.Font.Underline = wdUnderlineSingle
    End Sub