View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Runtime Error '1004' Method 'ActiveChart' of Object '_Global' failed

Well actually Shapes(shapename).formula doesn't work

mySheet.Shapes(string-shapename).DrawingObject.formula =

Did you try that as I suggested before

I agree with you that its because I'm
selecting it its giving me an issue. I'm not really sure how to do it
without selecting it however :

objRptWS.ChartObjects(objChart.NAME).Activate
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.Orientation = 90
Set objChart = Nothing



Looks like you already have a reference to the chartobject or chart with
'objChart'. Without selecting, replace all your quoted code above with
simply -

if 'objChart' is a chartobject -
objChart.Chart.Axes(xlCategory).TickLabels.Orienta tion = 90

if 'objChart' is a chart-
objChart.Axes(xlCategory).TickLabels.Orientation = 90

Oops, reviewing the thread I see 'objChart' is a chartobject, and I had
omitted the .Chart in my original suggestion to avoid selecting.

Regards,
Peter T


wrote in message
oups.com...
Well actually Shapes(shapename).formula doesn't work
either .TextBoxes(BoxName).Formula works don't know why, it doesn't
really matter so much I know there is subtle annoying differences
between VB in excel and using excel VB from access. For example a
really annoying one is how excel uses printer names and how access
does it. In access it just needs the server path but in excel it also
adds where in your printers it is (assuming) :
\\ServerPath on Ne0x (Where x is some number that is unique to
each computer)

I meant to write that, the code doesn't happen 'til right 'at the end'
after the entire report has pretty much been generated its just an
axes formatting script. I agree with you that its because I'm
selecting it its giving me an issue. I'm not really sure how to do it
without selecting it however :

objRptWS.ChartObjects(objChart.NAME).Activate
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.Orientation = 90
Set objChart = Nothing


After using your first suggestion I took all the other sheet and cell
selections out, per your suggestion. It worked great so all thats left
is the above. In general though do you know of a good resource I
could use, besides the reference library that is packaged with access.
Its not very in depth and most books usually focus on one program or
the other not their interaction.