久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

使用vba將一個(gè)word文檔的內(nèi)容復(fù)制到另一個(gè)word文檔中

 昵稱163835 2022-07-30 發(fā)布于廣東
本文介紹了使用vba將一個(gè)word文檔的內(nèi)容復(fù)制到另一個(gè)word文檔中的處理方法,,對(duì)大家解決問題具有一定的參考價(jià)值,,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我已經(jīng)多年沒有使用 VB,,所以如果這很明顯,,請(qǐng)?jiān)徫?我正在嘗試編寫一個(gè) word vba 宏,以便在顯示用戶表單的模板中使用,,然后根據(jù)用戶表單導(dǎo)入 fileA.docx,、fileB.docx 或 fileC.docx 的內(nèi)容.(之后我將使用書簽來填寫一些表單數(shù)據(jù),,我不知道這是否相關(guān)).文件 A,、B 和 C 將包含具有一些基本格式(例如列表)的文本,但沒什么特別的.

I haven't used VB for years, so please forgive me if this turns out to be obvious. I'm trying to write a word vba macro for use in a template which will display a userform and then import the contents of fileA.docx, fileB.docx, or fileC.docx depending on the userform. (After that I'm going to use bookmarks to fill in some form data, I don't know if that's relevant). Files A, B, and C will contain text with some basic formatting such as lists, but nothing fancy.

我在網(wǎng)上看到的解決方案可以將文件的內(nèi)容復(fù)制到一個(gè)新文件,,但理想情況下,,我想將其中一個(gè)文件的全部導(dǎo)入到我從模板中獲取的當(dāng)前未命名的新文件中.我認(rèn)為我遇到問題的地方是將選擇切換到這些文件之一,然后返回到新的未命名文檔,,盡管我可以用手確保我也正確復(fù)制.

The solutions I've seen online can copy the contents of file to a new file, but ideally I would like to import the entirety of one of those files into the new, currently unnamed file that I'm getting from the template. I think where I'm running into problems is with switching the selection to one of those files, and then back to the new unnamed document, though I could use a hand to make sure I'm copying correctly as well.

更新:我把事情弄得太難了,,盡管這里的答案讓我指出了正確的方向(謝謝,!).最后我只做了

Update: I was making things too hard, though the answers here got me pointed in the right direction (thanks!). In the end I just did

ThisDocument.Activate Selection.InsertFile('fileA')

它給了我我想要的一切的原始轉(zhuǎn)儲(chǔ).

which gives me the raw dump of everything that I wanted.

推薦答案

使用這些命令,您可以在您使用的 Document 以及復(fù)制和粘貼元素之間切換:

Using commands such as these you can switch between which Document you're using and copy and paste elements:

ThisDocument.Activate 'Sets the main document active
Documents('Name.doc').Activate 'Activates another document

您可以使用復(fù)制命令在文檔中插入,、復(fù)制和粘貼內(nèi)容.

You can insert, copy and paste things in and out of documents using copy commands.

ThisDocument.Range.InsertAfter('String') 'Insert text Selection.WholeStory 'Select whole document Selection.Expand wdParagraph 'Expands your selection to current paragraph Selection.Copy 'Copy your selection Documents('name.doc').Activate 'Activate the other document Selection.EndKey wdStory 'Move to end of document Selection.PasteAndFormat wdPasteDefault 'Pastes in the content

然后,,您可以對(duì)其進(jìn)行格式化,或使用之前的原始格式復(fù)制并粘貼它們.

You can then go and format such, or copy and paste them with original formatting from before.

這篇關(guān)于使用vba將一個(gè)word文檔的內(nèi)容復(fù)制到另一個(gè)word文檔中的文章就介紹到這了,,希望我們推薦的答案對(duì)大家有所幫助,,也希望大家多多支持IT屋!

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶發(fā)布,,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購買等信息,,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請(qǐng)點(diǎn)擊一鍵舉報(bào),。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多