VB scripped works in Excel 2003 but fails in 2007

D

DWad

Our roll out of Office 2007 has been put on hold because our engineering
department has an excel spreadsheet in Excel 2003 they have used for years
but fails in Excel 2007

The error is
Run-time error '-2147417848 (800 10 108)':
Method 'Offset' of object 'Range' failed

When I run debug after the failure this is the section of code that is high
lighted
.Chart.SetSourceData _
Source:=.TopLeftCell.Offset(0, -3).Resize(RepMeasurements, 2), _
PlotBy:=xlColumns

I'm a network guy so VB is not my strong point.

Thank you for any help.
 
J

Jim Cone

..Offset(0, -3) moves the range reference to the left by three columns.
If the TopLeftCell is in one of the first three columns then the code
will fail as you can't reference a location that is not on the sheet.

Also, budget some overtime, you will have more complaints about xl2007.
--
Jim Cone
Portland, Oregon USA




"DWad"
wrote in message
Our roll out of Office 2007 has been put on hold because our
engineering department has an excel spreadsheet in Excel 2003
they have used for years but fails in Excel 2007
The error is
Run-time error '-2147417848 (800 10 108)':
Method 'Offset' of object 'Range' failed

When I run debug after the failure this is the section of code that is high
lighted
.Chart.SetSourceData _
Source:=.TopLeftCell.Offset(0, -3).Resize(RepMeasurements, 2), _
PlotBy:=xlColumns

I'm a network guy so VB is not my strong point.
Thank you for any help.
 
J

Jim Rech

I tried to duplicate the error by running this code:

MsgBox Sheet1.Shapes("chart 2").TopLeftCell.Offset(0, -3).Address

but no problem. I'm not sure what your object was exactly since you didn't
post that part of your code.

Of course if the chart were too far left you'd get an error but that would
be true in Excel 2003 also. And the error would be different that what you
reported.

I had to tweak a lot of my code dealing with shapes to get it running in
Excel 2007.

--
Jim
| Our roll out of Office 2007 has been put on hold because our engineering
| department has an excel spreadsheet in Excel 2003 they have used for years
| but fails in Excel 2007
|
| The error is
| Run-time error '-2147417848 (800 10 108)':
| Method 'Offset' of object 'Range' failed
|
| When I run debug after the failure this is the section of code that is
high
| lighted
| .Chart.SetSourceData _
| Source:=.TopLeftCell.Offset(0, -3).Resize(RepMeasurements, 2), _
| PlotBy:=xlColumns
|
| I'm a network guy so VB is not my strong point.
|
| Thank you for any help.
 

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