回复 10楼 lianyicq
哎,无法, 才学20天,这些难一点的基本要找程序乱改,又看不懂,只能改好运行满足要求就好。。其实就是想把之前原word{cd1-7}代替成了数值再加一项加图片,然后一起保存 CommonDialog1.Filter = "Word文档(*.docx)|*.docx" '存储文件 弹出一个保存的界面存好,这就是所要输出的word而不改动原word 但是加来加去都不知道怎么把2个程序整合一起。- -!
回复 11楼 huwenyi7758
没法调试,只加了图片相关代码,你试试,有问题再改。不知道图片的插入位置程序代码:
Private Sub Command5_Click() Dim L1 As Double, L2 As Double, L3 As Double Dim wrdDoc As Word.Document 'Modify Dim wrdPic As Word.InlineShape 'Modify L1 = Text11.Text L2 = Text12.Text L3 = Text13.Text Label54.Caption = L1 + L2 + L3 Label55.Caption = L1 * L2 * L3 Label58.Caption = Text9.Text Label59.Caption = Text10.Text Dim wordObj Set wordObj = CreateObject("Word.Application") Set wrdDoc = wordObj.Documents.Open("E:\编程\计算书模板\1+1.docx") 'Modify With wrdDoc 'Modify 'With wordObj.Documents.Open("E:\编程\计算书模板\1+1.docx") CommonDialog1.Filter = "Word文档(*.docx)|*.docx" '存储文件 CommonDialog1.ShowSave If CommonDialog1.FileName = "" Then K1 = 3 Else With .Content .Find.MatchCase = True .Find.Execute "{cd1}", , , , , , , , , Text11, 2 .Find.Execute "{cd2}", , , , , , , , , Text12, 2 .Find.Execute "{cd3}", , , , , , , , , Text13, 2 .Find.Execute "{cd4}", , , , , , , , , Label54, 2 .Find.Execute "{cd5}", , , , , , , , , Label55, 2 .Find.Execute "{cd6}", , , , , , , , , Label58, 2 .Find.Execute "{cd7}", , , , , , , , , Label59, 2 End With Set wrdPic = wrdDoc.Range.InlineShapes.AddPicture(FileName:="图片文件路径及名称", LinkToFile:=False, SaveWithDocument:=True) 'Modify wrdPic.ScaleHeight = 50 'Modify wrdPic.ScaleWidth = 50 'Modify .SaveAs CommonDialog1.FileName End If End With wordObj.Quit End Sub