Here is an example of the code (PastePicture is a function to paste
the graph from the clipboard into the image control; the code comes
originally from the website of Stephen Bullen and is too long to
include here).
What may happen is that the Image2-control is not filled with the
correct Chart, but with the one that goes into the Image1-control. I
conclude from this that the clipboard is not yet filled with the right
image at the moment of executing the call to PastePicture. Thus we
need to make sure, that this part of the code is executed before
calling PastePicture. Thanks for your assistance,
JH
*****************************************************


Call ShowChart01
Call ShowChart02
Call ShowChart03

Sub ShowChart01()
    Sheets("Chart-01").Select
    Calculate
    ActiveChart.ChartArea.Copy
    Set frmMain.Image1.Picture = PastePicture(xlPicture)
    frmMain.Image1.Visible = True
    ActiveSheet.Deselect
End Sub

Sub ShowChart02()
    Sheets("Chart-02").Select
    Calculate
    ActiveChart.ChartArea.Copy
    Set frmMain.Image2.Picture = PastePicture(xlPicture)
    frmMain.Image2.Visible = True
    ActiveSheet.Deselect
End Sub

Sub ShowChart03()
    Sheets("Chart-03").Select
    Calculate
    ActiveChart.ChartArea.Copy
    Set frmMain.Image3.Picture = PastePicture(xlPicture)
    frmMain.Image3.Visible = True
    ActiveSheet.Deselect
End Sub


On 6 sep, 16:42, ashish koul <koul.ash...@gmail.com> wrote:
> Hi John,
>
> please try this see if it helps
>
> after u copy  and paste  first image add
>
> Application.CutCopyMode = False
>
> this way u can check if loop is working properly or not
>
> use below statement to make it wait for 5 second then resume ur code
>
> Application.Wait Now + TimeValue("00:00:05")
>
> also can you share your code with us.
>
>
>
>
>
> On Tue, Sep 6, 2011 at 6:52 PM, dguillett1 <dguille...@gmail.com> wrote:
> > I am not understanding. Perhaps a sample file dguillett1 @gmail.com
>
> > -----Original Message----- From: John Holland
> > Sent: Tuesday, September 06, 2011 2:14 AM
>
> > To: MS EXCEL AND VBA MACROS
> > Subject: Re: $$Excel-Macros$$ processor to slow for proper sequential
> > processing of vba code ?
>
> > Thanks dguillett1 for your assistance, but i am not sure this is the
> > right track. Perhaps it is my lack of knowledge, but i cannot this
> > code to work. What i need is to make sure that some code is completely
> > excecuted before a next part of code is processed. How can i control
> > the VBA code to wait with processing until the physical part of a code
> > has been executed properly, i.e. put an Excel graph into the Windows
> > clipboard and paste it into an image control (HERE THE CODE NEEDS TO
> > WAIT UNTIL THIS PART IS PROCESSED), then continue with putting a next
> > graph into the clipboard and paste that one into another image control
> > (HERE THE CODE NEEDS TO WAIT UNTIL THIS PART IS PROCESSED), and so on.
> > any further suggestions are most welcome,
> > cheers,
> > JH
>
> > On 5 sep, 15:55, "dguillett1" <dguille...@gmail.com> wrote:
>
> >> application.enableevents=false
> >> code block
> >> application.enableevents=true
>
> >> -----Original Message-----
> >> From: John Holland
> >> Sent: Monday, September 05, 2011 3:28 AM
> >> To: MS EXCEL AND VBA MACROS
> >> Subject: $$Excel-Macros$$ processor to slow for proper sequential
> >> processing
>
> >> of vba code ?
>
> >> I am running into the problem that some VBA code is not processed in
> >> time before a next statement can be executed. For example i want to
> >> put a certain Excel graph into the Windows Clipboard and then echo it
> >> in an image control on a userform. After that comes a 2nd graph in
> >> another image control and so on. What happens is that the statements
> >> for the 2nd graph are not executed properly because the second graph
> >> is not put into the Clipboard in time to be echoed into the 2nd image
> >> control. This 2nd image control shows the first graph in stead of the
> >> 2nd one.
>
> >> My question is if there is a way to make sure that some code is
> >> executed properly before continuing with other code?
>
> >> thanks for your kind assistance,
> >> JH
>
> >> --
> >> ------------------------------**------------------------------**
> >> ---------------­-------
> >> Some important links for excel users:
> >> 1. Follow us on TWITTER for tips tricks and links :http://twitter.com/**
> >> exceldailytip <http://twitter.com/exceldailytip>
> >> 2. Join our LinkedIN group 
> >> @http://www.linkedin.com/**groups?gid=1871310<http://www.linkedin.com/groups?gid=1871310>
> >> 3. Excel tutorials 
> >> athttp://www.excel-macros.**blogspot.com<http://www.excel-macros.blogspot.com>
> >> 4. Learn VBA Macros 
> >> athttp://www.quickvba.**blogspot.com<http://www.quickvba.blogspot.com>
> >> 5. Excel Tips and Tricks 
> >> athttp://exceldailytip.**blogspot.com<http://exceldailytip.blogspot.com>
>
> >> To post to this group, send email to excel-macros@googlegroups.com
>
> >> <><><><><><><><><><><><><><><>**<><><><><><><>
> >> Like our page on facebook , Just follow below linkhttp://
> >>www.facebook.com/**discussexcel-<http://www.facebook.com/discussexcel->Tekst
> >> uit oorspronkelijk bericht niet weergeven -
>
> >> - Tekst uit oorspronkelijk bericht weergeven -
>
> > --
> > ------------------------------**------------------------------**
> > ----------------------
> > Some important links for excel users:
> > 1. Follow us on TWITTER for tips tricks and links :http://twitter.com/**
> > exceldailytip <http://twitter.com/exceldailytip>
> > 2. Join our LinkedIN group 
> > @http://www.linkedin.com/**groups?gid=1871310<http://www.linkedin.com/groups?gid=1871310>
> > 3. Excel tutorials 
> > athttp://www.excel-macros.**blogspot.com<http://www.excel-macros.blogspot.com>
> > 4. Learn VBA Macros 
> > athttp://www.quickvba.blogspot.**com<http://www.quickvba.blogspot.com>
> > 5. Excel Tips and Tricks 
> > athttp://exceldailytip.blogspot.**com<http://exceldailytip.blogspot.com>
>
> > To post to this group, send email to excel-macros@googlegroups.com
>
> > <><><><><><><><><><><><><><><>**<><><><><><><>
> > Like our page on facebook , Just follow below link
> >http://www.facebook.com/**discussexcel<http://www.facebook.com/discussexcel>
> > --
> > ------------------------------**------------------------------**
> > ----------------------
> > Some important links for excel users:
> > 1. Follow us on TWITTER for tips tricks and links :http://twitter.com/**
> > exceldailytip <http://twitter.com/exceldailytip>
> > 2. Join our LinkedIN group 
> > @http://www.linkedin.com/**groups?gid=1871310<http://www.linkedin.com/groups?gid=1871310>
> > 3. Excel tutorials 
> > athttp://www.excel-macros.**blogspot.com<http://www.excel-macros.blogspot.com>
> > 4. Learn VBA Macros 
> > athttp://www.quickvba.blogspot.**com<http://www.quickvba.blogspot.com>
> > 5. Excel Tips and Tricks 
> > athttp://exceldailytip.blogspot.**com<http://exceldailytip.blogspot.com>
>
> > To post to this group, send email to excel-macros@googlegroups.com
>
> > <><><><><><><><><><><><><><><>**<><><><><><><>
> > Like our page on facebook , Just follow below link
> >http://www.facebook.com/**discussexcel<http://www.facebook.com/discussexcel>
>
> --
> *Regards*
> * *
> *Ashish Koul*
> *akoul*.*blogspot*.com <http://akoul.blogspot.com/>http://akoul.posterous.com/
> *akoul*.wordpress.com <http://akoul.wordpress.com/>
> My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830>
>
> P Before printing, think about the environment.- Tekst uit oorspronkelijk 
> bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to