If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > OWC11 spreadsheet addcomment to cell

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-02-10, 11:02
vlady2009 vlady2009 is offline
Registered User
 
Join Date: Jun 2010
Posts: 3
OWC11 spreadsheet addcomment to cell

I'm trying to use the following to add comments to a cell in a Microsoft Office Spreadsheet 11.0 component on a form in Access 2003

Dim cntlExcel As Control
Set cntlExcel = Me.Controls("myExcelSheet")

cntlExcel.Range("A1").AddComment
cntlExcel.Range("A1").Comment.Visible = False
cntlExcel.Range("A1").Comment.Text = "blah"

which results in "Object doesn't support this property or method" error

I'm doing something wrong, or is it the case that OWC spreadsheet component cannot be used to add comments to cells via VBA code (as per error message).

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 06-02-10, 11:37
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 495
Hi,

Unlike Excel.Range, OWC11.Range doesn't support comments.

There may be workarounds, depending on when the comments should be shown at what their ultimate purpose is.
__________________
Colin

RAD Excel Blog

Other tutorials:
Array Formulas | Deleting Rows with VBA
Reply With Quote
  #3 (permalink)  
Old 06-02-10, 20:45
vlady2009 vlady2009 is offline
Registered User
 
Join Date: Jun 2010
Posts: 3
Thanks Colin,

I'm using the spreadsheet to produce output from the database in the form of Excel files (and manipulation/display of the output data will be done within Excel). Since the user has a number of options for flagging/handling various scenarios with the data prior to output (eg replace "missing" entries for a date range with either zero, leave as null, or insert "NA" etc) it would be "nice" to tag such manipulated data in the output spreadsheet with a comment. If comments for cells cannot be produced by OWC11, I was thinking of just using cell formatting instead (eg red text indicates tagged/manipulated data).

Thanks again.
Reply With Quote
  #4 (permalink)  
Old 06-03-10, 06:22
Colin Legg Colin Legg is offline
Registered User
 
Join Date: Sep 2008
Location: London, UK
Posts: 495
Hi,

Colouring sounds like a good solution in this case. Additionally, if you wanted to, you could use the control's MouseOver event handler to update a label on your form with some information as the user moves the mouse over the relevant ranges.
__________________
Colin

RAD Excel Blog

Other tutorials:
Array Formulas | Deleting Rows with VBA
Reply With Quote
  #5 (permalink)  
Old 06-03-10, 08:12
vlady2009 vlady2009 is offline
Registered User
 
Join Date: Jun 2010
Posts: 3
Colin,

You're advice about using Excel event handlers got me thinking.

Using Workbook_Open() to automatically fire-off some code when a user opens the spreadsheet that is output from the database/OWC11 spreadsheet, that searchs through the used range looking for "red text" (that indicates tagged/manipulated data - or different types of formatting which can be used to indicate different options selected during the creation of the spreadsheet by the database) and then converting this to comments, is a bit of cludge but gives the desired result.

Regards
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On