save file

A

asburypark98

Hi,
I've got a problem in my code I've written below.
The loop works for the first, third and fourth graphic: that is,
it saves them. But it doesn't save the second graph.
I've put a "pause" at the start and at the end of the loop, but
I haven't solved the problem..

Any suggestion very appreciated!

'-----------------------------------------------------

Private Sub CommandButton1_Click()

Dim i As Integer

Dim a As Range
Dim b As Integer
Set a = Range("C10:C13")

Dim PauseTime, Start, Finish, TotalTime

b = a.Rows.Count

For i = 1 To b

PauseTime = 3
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop
Finish = Timer
TotalTime = Finish - Start

BLP = DDEInitiate("winblp", "bbk")
Call DDEExecute(BLP, "<blp-1><cancel>" & a(i).Text &
"<Index>GPC<GO>")

PauseTime = 3
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop
Finish = Timer
TotalTime = Finish - Start

Call DDEExecute(BLP, "<SAVE><GO>")
Call DDETerminate(BLP)

Next i

End Sub

'------------------------------------------------------------------------
 
P

Puppet_Sock

asburypark98 said:
Hi,
I've got a problem in my code I've written below.
The loop works for the first, third and fourth graphic: that is,
it saves them. But it doesn't save the second graph.
I've put a "pause" at the start and at the end of the loop, but
I haven't solved the problem..

Any suggestion very appreciated!
[code that Puppet Sock didn't understand snipped]

When you have a problem like this, the first thing to do is
simplify and see if the problem is still there. So, get rid of
those timers, get rid of all the extraneous stuff, reduce to
one single graphic, and see if it works properly. That is,
try to save *only* the second graphic. Maybe there is
something whacky about that graphic. Oh, I don't know,
something whacky like it's not in the column you think
it is, or it's protected or grouped or some weird thing.

If that's it, then by reducing the problem to just it, you
may get rid of all the stuff you are looking at instead of
the problem. And don't forget to be stepping through your
code and examing things at each line.

If that does not reveal the problem, then look at each part
in turn, and make sure each part is working correctly.

And if all that fails, then put your code aside for the
moment, and do a complete re-write of your loop, fresh
without looking at the old code. Maybe you will reveal
what the problem is with a fresh look.
Socks
 
A

asburypark98

Thanx a lot Puppet .
I tried the code on the wrong one and it goes right now.
I've modified the time-pause: I put a longer one.
It seems goes better. But I'm not sure it will be always right.
 

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