Picture numbering past 65536?

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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
 
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
 
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?
 
Back
Top