hi everyone out there,

i am developing an excel application to display some charts for number of statistical tests.
application is going to be used by students as a support to tutorials and should be hosted on network drive rather than be installed on each individual machine in a classroom.

problem code:

sub cmdbutton_onclick()
Dim mychart As ChartObjects
Dim x As Integer - counter
Dim chartlist As Integer -number of charts on each sheet
chartlist = ActiveSheet.ChartObjects.Count
Set mychart = ActiveSheet.ChartObjects
For x = 1 To chartlist
mychart(x).Chart.PrintPreview
Next
end sub

all sheets are password protected and i intend to password protect workbook before set share mode for workbook and this is when my problem starts. this code displays all charts from any active sheet when workbook is not shared but if i set workboot to share mode then code displays the last chart that has been displayed while in no share mode.
i tried to read chartobject names and indexes form the loop and they display accurate names and indexes then comes line
mychart(x).Chart.PrintPreview
which displays the last chart as i mentioned earlier.

any advice would be appriciated or direction where to look for help.

thanks