|
-
Jul 1st, 2004, 09:25 AM
#1
Thread Starter
New Member
printpreview charts in shared workbook: help!!!
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
-
Jul 7th, 2004, 03:07 AM
#2
Thread Starter
New Member
Unfortunately, sharing workbooks interferes with a lot of standard Excel
features.
Do you need to save the changes made by each student? If not, then save
the file not as shared but as read only.
If you have to share the workbook, you can only print preview the
individual charts if you use chart sheets, not embedded chart objects.
This amended code worked in this case:
Sub PrintCharts()
Dim myChart As Chart
Dim X As Integer
Dim nm As String, mi As Long
For Each myChart In ActiveWorkbook.Charts
nm = myChart.Name
mi = myChart.Index
MsgBox "name is " & nm & " and index is " & mi
myChart.PrintPreview
Next
End Sub
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|