Opening OLE Object Sync Issue within VBA Code

G

Gary

I have a Table with OLE object in a field of the table. I use a form with
the table as its RecordSource. When I Activate the OLE object in the form,
the first time, the VBA code doesn't advance until the OLE object is open
(Visio in my case). When the program loops, the second time, the VBA code
doesn't stop for the OLE to be open.

This is my code:

Do Until rs.EOF
Forms![GenPPT]![OLEFile].Action = acOLEActivate
Set AppVisio = GetObject(, "visio.Application")
Set DocObj = AppVisio.ActiveDocument

More VBA Code Here
Stop

More VBA Code Here
Stop

AppVisio.Quit
Set AppVisio = Nothing

rs.MoveNext
Loop


The problem is as follow:

1) When the VBA Code first Activate the OLE in my form, it waits until
the OLE (Visio) is open before moving on in the VBA Code.

2) After the first time, when it loops back, the VBA code advance to the
first "Stop" while the OLE is activating in from the Form.

3) I see this issue with Acc2000, 2003, and 2007. I am using XP sp2 OS.

Can someone tell me how I can sync them up or is there something I am doing
wrong???

Thanks You,

Gary
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top