-
FlexPro
- Zoom sur FlexPro
- Fonctionnalités & Options
- Domaines d’application
- Tous les avantages
- Nouveau dans FlexPro 2021
- Testez FlexPro gratuitement
- FlexPro View OEM Freeware
- Conseils d’achat
- Login
- Langue
- +49 6894 929600
- infoweisang.com
- Google Maps
- Produits
- News
- Support
- Société
- Emplois
- Contact
- Login
- Langue
- +49 6894 929600
- infoweisang.com
- Google Maps
Append many documents in a new one
Accueil > Community > Automation and VBA > Append many documents in a new one
- This topic has 4 replies, 2 voices, and was last updated 16 years, 12 months ago by
Nicolas Beaupré.
-
AuthorPosts
-
February 8, 2006 at 2:08 am #12419
Nicolas Beaupré
MemberHi,
Is there a way in VBA to append documents? (or pages) In Flexpro, I can open an empty document and, with drag and drop, I insert another existing document in the new one. It is added at the end of the open document. How may I do that in VBA?For example, in my application, I got a lot of small “report_x” document. I want to create a new document named “GlobalReport” wich is the sum of all the others document. After doing this, I’ll be able to edit the pages number of “GlobalReport” and print it alone.
Thanks!
February 8, 2006 at 2:08 am #8100Nicolas Beaupré
MemberHi,
Is there a way in VBA to append documents? (or pages) In Flexpro, I can open an empty document and, with drag and drop, I insert another existing document in the new one. It is added at the end of the open document. How may I do that in VBA?For example, in my application, I got a lot of small “report_x” document. I want to create a new document named “GlobalReport” wich is the sum of all the others document. After doing this, I’ll be able to edit the pages number of “GlobalReport” and print it alone.
Thanks!
February 9, 2006 at 2:10 am #8685Bernhard Kantz
ParticipantIn FlexPro there is no method to append a document to another document.
But there is the possibility to select the shapes of the document. Then you can use the Copy and the Paste method.
Example:
Dim oSourceDoc As Document Dim oDestDoc As Document Dim i As Integer Set oSourceDoc = ActiveDatabase.RootFolder.Object("Doc1", fpObjectTypeDocument) Set oDestDoc = ActiveDatabase.RootFolder.Object("Doc2", fpObjectTypeDocument) Dim oPage As Shapes Set oPage = oSourceDoc.Pages(1) For i = 1 To oPage.Count oSourceDoc.Select oSourceDoc.Selection.Collapse oPage.Item(i).Select oSourceDoc.Selection.Copy oDestDoc.Select oDestDoc.Selection.Paste oDestDoc.Selection.Collapse Next i
February 10, 2006 at 12:20 am #8686Nicolas Beaupré
MemberThanks for the code! It works, but I had to add these lines :
oSourceDoc.Select oSourceDoc.Open = True oSourceDoc.Selection.Collapse oPage.Item(i).Select oSourceDoc.Selection.Copy oDestDoc.Select oDestDoc.Open = True oDestDoc.Selection.Paste oDestDoc.Selection.Collapse
Otherwise, the operations .Collapse and .Paste couldn’t work when the documents are closed.
Also, this code copies the shapes in the first page of my document. Suppose I add a new page in the document
Dim oNewPage As Shapes Set oNewPage = oSourceDoc.pages.Add
How can I select the new page so the shape will be copied in it ?
Thanks
February 10, 2006 at 12:51 am #8687Bernhard Kantz
ParticipantYou can use the methods NextPage and PreviousPage of a DocObjectSelection object.
oDestDoc.Selection.PreviousPage oDestDoc.Selection.NextPage
-
AuthorPosts
- You must be logged in to reply to this topic.