Jump to content

Search the Community

Showing results for tags 'Word Merge'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Location


WWW


Interests

Found 1 result

  1. Hi All, I am a little stuck - I have written a word merge autoit program for a friend of mine. It use to run fine and then some Group Policies where applied to his machine. Now he gets the following error: The requested action with this object has failed. Runs ok as administrator but not as a normal user. The IT guys says, "if you can tell me which policy to change, then I will look into it"... (please imagine a gruff voice) Great help he was. The IT guy said it took him 3 days to setup the group policies. I know nothing of group policies but I would like to help my friend. ; ----------------------------------------------------------------------------- ; Name: mymerge ; Date: 16/05/2008 AP ; ----------------------------------------------------------------------------- #NoTrayIcon #include <Word.au3> #include <File.au3> Opt("MustDeclareVars", 1) Opt("ExpandEnvStrings", 1) global $param1, $param2, $param3 global $wd, $dc, $mm, $rng, $ver global $logfile = @DesktopDir & "\debug.log" $param1 = "WordMerge" $param2 = "C:\template.doc" $param3 = "C:\data.csv" _WordMerge() func _WordMerge() local $template = "" local $data = "" local $short_name = "" $template = $param2 _LogThis("Word template file: " & $template) if ($template = "") then _LogThis("No template file provided...") MsgBox(0, "Error", "Unable to proceed - missing word template file.") SetError(1) return endif if not FileExists($template) then MsgBox(0, "Error", "Template file does not exist. (" & $template & ")") SetError(1) return endif $data = $param3 _LogThis("Data file: " & $data) if ($data = "") then _LogThis("No data file provided...") MsgBox(0, "Error", "Unable to proceed - missing word data file.") SetError(1) return endif if not FileExists($data) then MsgBox(0, "Error", "Data file does not exist. (" & $data & ")") SetError(1) return endif _LogThis(" - opening template file: " & $template) $wd = _WordCreate($template,0,0) ; Start invisible. if @error then _LogThis(" - unable to open ms word...") MsgBox(0,"Error","Unable to start word...") SetError(1) _MyExit() endif $ver = $wd.version _LogThis(" - word version: " & $ver) ; $dc = _WordDocOpen ($wd, $template) $dc = _WordDocGetCollection ($wd, 0) $wd.DisplayAlerts = 0 _WordPropertySet ($wd, "visible", False) ; Mailmerge bits. _LogThis(" - processing merge...") $mm = $dc.MailMerge $mm.OpenDataSource ('"' & $data & '"', 0, true, true, true, false, "", "", false) $mm.Destination = 0 ; New document. $mm.execute ; Close template. _WordDocClose($dc,0) Sleep(100) ; Reset document to new document, then save to new file. $dc = _WordDocGetCollection ($wd, 0) $wd.ActiveWindow.ActivePane.View.Zoom.Percentage = 100 _WordPropertySet ($wd, "visible", True) $wd.DisplayAlerts = -1 Sleep(300) WinActivate("Form") _LogThis("Exiting...") exit endfunc ;==> _WordMerge func _LogThis($txt) local $sDateNow local $sTimeNow local $fh ; If Logging then... $sDateNow = @YEAR & "-" & @MON & "-" & @MDAY $sTimeNow = @HOUR & ":" & @MIN & ":" & @SEC $txt = $sDateNow & " " & $sTimeNow & " : " & $txt $fh = FileOpen($logfile, 1) if $fh = -1 then SetError(1) return 0 endif FileWriteLine($fh, $txt) FileClose($fh) return endfunc ;==> _LogThisSorry for my coding standards. Word does get started and hidden, then the error appears. Can anyone please help.
×
×
  • Create New...