Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
| Search | Today's Posts | Mark Forums Read
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 21st, 2006, 02:00 AM
Registered User
 
Join Date: Jun 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Accessing a Pre-existing Shape on a Worksheet


I am attempting to access a Shape or Drawing Object on an Excel worksheet to
change its Onaction, ListFillRange and LinkedCell.

In VBA, you did this:
Code:
sheet.DrawingObjects("name").OnAction= "action"
sheet.DrawingObjects("name").ListFillRange= "ListFillRange"
In C#:
I can get access to a Shape object:
Code:
sheet.Shapes.Item("name")
This gives me access to OnAction, but not
ListFillRange or LinkedCell.

I have tried this:
Code:
//gets all Drawing Objects on a sheet
Excel.DrawingObjects d =
(Excel.DrawingObjects)sheet.DrawingObjects(missing)
;
return (Excel.DrawingObjects)d.Item(name);
//crashes here

The problem is that the object [d.Item(name)] is a COM__Object, and it is NOT null, but it cannot be cast to anything useful (like an OLEObject). I do not know what to cast it to to be able to access the properties of the object.

Help!!!!!!!!!!!!!!!
I have spent too long trying to figure this out.
excelthoughts




Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting to Existing Excel Worksheet from Access kfs Access VBA 2 August 3rd, 2006 10:56 AM
Rotating shape in VBA (not center of shape) Piblon Excel VBA 3 April 13th, 2006 04:04 AM
Adding existing and non-existing attributes spencer.clark XSLT 5 July 27th, 2005 04:02 PM
How to get the value of pre? Edward King Javascript How-To 2 June 28th, 2005 07:38 AM
Shape My Command-Please btpoole VB Databases Basics 0 March 7th, 2004 12:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.