Picture numbering past 65536?

G

Guest

I am using an excel spreadsheet as a template for webpages. For each page I
insert 5 pictures which I create elsewhere. As each picture is inserted,
Excel gives it a number. When you select the graphic you see the number in
the Name box.
The problem I have is that when the number of Pictures gets to 65536, VBA
gives an error message when trying to insert the next picture. The excel
file keeps a running total of the pictures inserted over time i.e. it doesn't
go back to zero when you close the file. Does anyone know how to set this
back to zero?
 
G

Guest

this is the code: -

graph1 = "R" & Sheets("LIST").Cells(i, 2).Value
temp1 = Range("dsgraphpath").Value & "\" & graph1 & ".cgm"
ActiveSheet.Pictures.Insert(temp1).Select

the picture is inserted by the macro but the code stops at the 2nd line with
the error message: -

Run time error '1004'
Select method of Picture class failed

Strange thing is that you can insert the chart using menu commands without a
problem but if you try to run the same process in VBA it fails. I am sure it
has something to do with the Picture number (ascribed by the application)
reaching 65536.

Thanks
 
E

Ed

I'm not sure what's going on, especially with only this much code. Maybe
someone with more expertise (almost anyone here!) can get a better handle on
this.

Is there a way to:
-- refer to each chart a different way?
-- reset the count without creating a reference to the wrong chart?
-- give each chart a different type of reference on creation?

Ed
 
T

the_real_ptb

I have a similar problem that requires the same solution. Does anyone
know how to reset the picture counter to zero (or one) so I can get
some control over the numer that is assigned to the pictures that I
insert?
 

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