找回密码
 加入
搜索
查看: 3750|回复: 2

[AU3基础] VB的代码 转换成AU3代码怎么都转换失败?(已解决)

[复制链接]
发表于 2015-1-12 10:18:45 | 显示全部楼层 |阅读模式
本帖最后由 PPTBS 于 2015-1-12 12:17 编辑
Private Sub Command1_click()
    Dim oApp As Word.Application
    Dim oDoc As Word.Document
    Dim oMerge As Word.MailMerge
    Dim oResult As Word.Document
    
    Set oApp = CreateObject("Word.Application")
    'Open a Word MailMerge document
    Set oDoc = oApp.Documents.Add("C:\bak\1.doc", False, wdNewBlankDocument, False)
    'Instanciate a MailMerge object
    Set oMerge = oDoc.MailMerge
    With oMerge
        'Set the source where your data will be coming from
        .OpenDataSource "C:\bak\2.xls"
        'Specify the output destination. ie: a new document or a printer etc
        .Destination = wdSendToNewDocument 'OR wdSendToPrinter if you just want to print
        .Execute
    End With
    'Do stuff with the document if you want via the oResult document object
    Set oResult = oApp.ActiveDocument 'This is your merged document (if shown).
    oApp.Visible = True
     ChangeFileOpenDirectory "C:\Documents and Settings\Administrator\桌面"
      ActiveDocument.SaveAs FileName:="1.doc", FileFormat:=wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=False
    oResult.Close SaveChanges:=False
    Set oResult = Nothing
    Set oMerge = Nothing
    oDoc.Close SaveChanges:=False
    Set oDoc = Nothing
    oApp.Quit SaveChanges:=False
    Set oApp = Nothing
VB的代码  转换成AU3代码怎么都转换失败


问题出在  wdNewBlankDocument 上面     wdNewBlankDocument 是常量   我用AU3 老是显示没有命名,转化成字符串格式又不对,给一点思路!
 楼主| 发表于 2015-1-12 10:30:03 | 显示全部楼层
本帖最后由 PPTBS 于 2015-1-12 10:42 编辑

请指教!
 楼主| 发表于 2015-1-12 11:14:22 | 显示全部楼层
WordConstants.AU3  解决
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-28 04:40 , Processed in 0.074789 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表