我用代码把word中的内容复制到excel中后,我想把excel中的内容按照word中的对齐方式对齐,比如:在word中标题是居中的,复制到excel后是左对齐的.不知道如何用代码实现,请多指教,谢谢!!!

解决方案 »

  1.   

    你从word拷贝的时候,可以取得word的格式吗?
      

  2.   

    比如 word中标题是居中的,你放到excle的时候,还能知道word中标题是居中的吗?
      

  3.   

    你从word拷贝的时候,可以取得word的格式吗?比如 word中标题是居中的,你放到excle的时候,还能知道word中标题是居中的吗?回答:在vb中可以取得word文字的大小,加粗.对齐方式我没有取到,想问问其他人能否取到?
      

  4.   

    Sub macro1()
    Dim par As Paragraph, index As Long, n As Long
    For Each par In ActiveDocument.Paragraphs
    index = par.Range.ParagraphFormat.Alignment
    n = n + 1
    If index = wdAlignParagraphCenter Then Debug.Print "第" & n & "短对齐方式:居中"
    If index = wdAlignParagraphLeft Then Debug.Print "第" & n & "短对齐方式:左对齐"
    If index = wdAlignParagraphRight Then Debug.Print "第" & n & "短对齐方式:右对齐"
    If index = wdAlignParagraphJustify Then Debug.Print "第" & n & "短对齐方式:两端对齐"
    Next
    End Sub