OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Thread Tools Search this Thread Display Modes
Old 07-04-2003, 11:59
Posts: n/a
Default Page selection and object moving problems

: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

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")
        For Each picshape In Doc.Pages(pagenum).FindShapes(Name:=(placeholder & "_pic"), Type:=cdrBitmapShape)
            picshape.SetBoundingBox xx, yy, sx, sy, True, cdrCenter
        Next picshape
    Next zulu
 End Function
Reply With Quote
Old 15-04-2003, 09:10
Alex's Avatar
Alex Alex is offline
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: Page selection and object moving problems


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!
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Break Each Object Apart within Selection geopig CorelDRAW/Corel DESIGNER VBA 2 15-04-2005 13:38

All times are GMT -5. The time now is 02:49.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com