![]() |
#1
|
|||
|
|||
![]()
:x Arg!
I have a a function that imports a graphic to a document, page and constraining box shape. Basically it imports the graphic, scans for the placeholder, copies the placeholders dimensions and position and moves the imported graphic to take the placeholders place. This works great in a one page doc, when I use it on a 2 page document I get unexpected results; if there is only one import call on the second page, the imported image takes the shape and size of the placeholder but not its position. if I repeat the same call previously, the old imported file and the new move to the correct position. I think the page flip happens and the code execution is lagging behind the page flip or somehting like that. Any suggestions to make this work a bit more reliably? -- Wolfgang Code:
Private Function GraphicsReplacer(Doc As Document, pagenum As Long, placeholder As String, filename As String) Dim zulu As Shape Dim picname As String Dim fs picname = filename Set fs = CreateObject("Scripting.FileSystemObject") LogEntry ("Checking for external Media Files") If (fs.fileexists(picname) = False) Then picname = "c:\!mcp\!templates\pictures\placeholder.jpg" 'LogEntry ("!!!!!!!!Warning: Missing Picture for this Property! [placeholder.jpg] used instead") End If Dim xx As Double, yy As Double Dim sx As Double, sy As Double Dim picshape As Shape For Each zulu In Doc.Pages(pagenum).FindShapes(Name:=placeholder, Type:=cdrRectangleShape) zulu.GetBoundingBox xx, yy, sx, sy Doc.Pages(pagenum).ActiveLayer.Import picname Doc.ActiveShape.Name = (placeholder & "_pic") DoEvents For Each picshape In Doc.Pages(pagenum).FindShapes(Name:=(placeholder & "_pic"), Type:=cdrBitmapShape) DoEvents picshape.SetBoundingBox xx, yy, sx, sy, True, cdrCenter Next picshape Next zulu End Function |
#2
|
||||
|
||||
![]()
Wolfgang,
I cannot reproduce the problem. Could you please try to create a small self-contained macro that demonstrate it? I mean something that I can run on my system and it always displayed the problem? From the limited tests that I did, it worked all the time. But I might not have done something that you were doing in your program... Anyway, if you can strip down your program to a state where it can just be run on my system and demonstrate the error, that'd be great! |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Break Each Object Apart within Selection | geopig | CorelDRAW/Corel DESIGNER VBA | 2 | 15-04-2005 13:38 |