技術(shù) 點(diǎn)
- 技術(shù)
- 點(diǎn)
- V幣
- 點(diǎn)
- 積分
- 5433
|
3#
發(fā)表于 2007-2-7 22:29:00
|
只看該作者
以下是引用蔣小楊在2007-2-7 11:46:00的發(fā)言:
參照大蝦們的示例制作了一個(gè)控制word自動(dòng)插入圖片并打印的東東
但插入兩張以上圖片時(shí)圖片重疊在一起,不能設(shè)置分開(kāi)。請(qǐng)高手出手相助
1、這個(gè)事例中不需要在vbe中引用word XX.X
2、代碼改動(dòng)如下:
Dim wordApp As Object
Set wordApp = CreateObject("word.application")
Set mydoc = wordApp.Documents.Open(CurrentProject.Path & "\yy.doc")
wordApp.Visible = True
wordApp.ActiveDocument.InlineShapes.AddPicture (CurrentProject.Path & "\1.jpg")
'區(qū)別就在這里,圖片是添加到Document的局部,而不是添加到整個(gè)Document
wordApp.Selection.TypeParagraph
wordApp.Selection.TypeParagraph
wordApp.Selection.TypeParagraph '二張圖片之間空3行
wordApp.ActiveDocument.InlineShapes.AddPicture (CurrentProject.Path & "\2.jpg")
set mydoc=nothing '釋放
set wordapp=nothing ‘釋放
3、代碼結(jié)束后,請(qǐng)釋放變量和引用。 |
|