从Word中的Word文本粘贴文本? [英] pasting text from Excel in Word header?

查看:134
本文介绍了从Word中的Word文本粘贴文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试添加 Belkin 到我的单词文档的标题。



情况:
Excel:A1 = Belkin | Word:标题需要获得Belkin

解决方案

这里是一个快速&肮脏的Excel VBA让你去 - 创建一个新的单词应用程序/单词文档,并将A1的内容粘贴到标题中。

  Sub CreateWordDocWithHeader()
Dim WApp As Word.Application
Dim WDoc As Word.Document
Dim WRng As Word.Range

设置WApp =新的Word .Application
WApp.Visible = True
设置WDoc = WApp.Documents.Add
设置WRng = WDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range
WRng = ActiveSheet 。[A1]

Set WRng = Nothing
设置WDoc = Nothing
设置WApp = Nothing
End Sub
/ pre>

希望这有帮助....祝你好运


I'm trying to add Belkin to the header of my word document.

Situation: Excel: A1 = Belkin | Word: header needs to get Belkin

解决方案

here's a quick & dirty Excel VBA to get you going - creating a new word application/word doc and pasting the content of A1 into the header ....

Sub CreateWordDocWithHeader()
Dim WApp As Word.Application
Dim WDoc As Word.Document
Dim WRng As Word.Range

    Set WApp = New Word.Application
    WApp.Visible = True
    Set WDoc = WApp.Documents.Add
    Set WRng = WDoc.Sections(1).Headers(wdHeaderFooterPrimary).Range
    WRng = ActiveSheet.[A1]

    Set WRng = Nothing
    Set WDoc = Nothing
    Set WApp = Nothing
End Sub

Hope this helps .... Good luck miked

这篇关于从Word中的Word文本粘贴文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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