我按照以下步骤处理VB6项目: - 单击命令按钮从dir打开文件。或创建一个新的。(word文档.DOC) - 将图像JPEG添加为徽标... - 保存结果 请,任何人都可以帮助设计和编码?
答案 0 :(得分:2)
记录Word VBA中的步骤。 VBA是VB6的语言。
这就是你得到的
Sub Macro10()
'
' Macro10 Macro
' Macro recorded 7/12/2014 by Fred
'
Documents.Open FileName:="Doc1.DOC", ConfirmConversions:=True, ReadOnly:= _
False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:= _
"", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", _
Format:=wdOpenFormatAuto, DocumentDirection:=wdLeftToRight
ChangeFileOpenDirectory "C:\Users\Fred\Documents\Pictures\"
Selection.InlineShapes.AddPicture FileName:= _
"C:\Users\Fred\Documents\Pictures\!cid_image001.gif", LinkToFile:= _
False, SaveWithDocument:=True
ActiveDocument.SaveAs FileName:="Doc1.DOC", FileFormat:=wdFormatDocument, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
End Sub
所以在VB6中创建对文档的引用
Set Wrd = GetObject("Yourfile")
然后将VBA代码调整到您的对象,例如; wrd.documents.open ...