Jump to content

Help on combining two word files


Recommended Posts

Hi,

I have two word files which i have to combine one after the other, it is containing lots of formatting and all. Sohow can i use auto it for combining both.

Is there any UDFs for this?

also I need to include Page Breaks after some predefined words.

Link to comment
Share on other sites

OK, this works so:

#include <Word.au3>
$sPath1 = "file1.doc"
$sPath2 = "file2.doc"
$oWord = _WordCreate($sPath1, 0, 1) ; visible
With $oWord.Selection
    .EndKey(6)
    .InsertBreak(7)
    .InsertFile($sPath2)
EndWith

Edit:

Best way to find out this: Make an macro in word, that this things do, than open VBA and translate this to autoit-code.

Edited by BugFix

Best Regards BugFix  

Link to comment
Share on other sites

will this work with .docx format also? :idea:

coz i am getting an error like

: ==> The requested action with this object has failed.:
$o_doc = $o_object.Documents.Open ($s_FilePath, $f_ConfirmConversions, $f_ReadOnly, $f_AddToRecentFiles, $s_PasswordDocument, "", $f_Revert, $s_WritePasswordDocument, "", $i_Format)
$o_doc = $o_object.Documents.Open ($s_FilePath, $f_ConfirmConversions, $f_ReadOnly, $f_AddToRecentFiles, $s_PasswordDocument, "", $f_Revert, $s_WritePasswordDocument, "", $i_Format)^ ERROR
Link to comment
Share on other sites

>Running:(3.3.6.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\oDx\Desktop\Macro\test.au3"    
C:\Program Files\AutoIt3\Include\Word.au3 (1293) : ==> Variable used without being declared.:
Return SetError($_WordStatus_Success, 0, 1)
Return SetError(^ ERROR

then this error comes!! :idea:

Link to comment
Share on other sites

sorry for the double post, but i really need some help here, pls!! :|

Edit: solved

I had to give "_WordErrorHandlerRegister()" after header file, i wax giving it the begining!

thanks!!! :idea:

Edited by obscurant1st
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...