Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Please Help Error 400 when running tested code

I have a large complex spreadsheet with 100's of comments that have
'spontaneously' taken on a variety of shapes and sizes. I applied VB code
(per Debra Dagleish) but get an Error 400 message when applied to this
spreadsheet. I have successfully applied the same macro to other
spreadsheets. Can someone help me identify the cause and implement a solution?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Please Help Error 400 when running tested code

One place to start is to post the code you are using and give us more
information about the problem you have encountered with the one particular
sheet. Also, explain what YOU expect the code to do.

"Ditto" wrote:

I have a large complex spreadsheet with 100's of comments that have
'spontaneously' taken on a variety of shapes and sizes. I applied VB code
(per Debra Dagleish) but get an Error 400 message when applied to this
spreadsheet. I have successfully applied the same macro to other
spreadsheets. Can someone help me identify the cause and implement a solution?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Please Help Error 400 when running tested code

The code I have tried to use is:

Sub Comments_AutoSize()
'posted by Dana DeLouis 2000-09-16
Dim MyComments As Comment
Dim lArea As Long
For Each MyComments In ActiveSheet.Comments
With MyComments
.Shape.TextFrame.AutoSize = True
If .Shape.Width 300 Then
lArea = .Shape.Width * .Shape.Height
.Shape.Width = 200
' An adjustment factor of 1.1 seems to work ok.
.Shape.Height = (lArea / 200) * 1.1
End If
End With
Next ' comment
End Sub

I was hoping that this would take all the comments in the worksheet and
resize them the same, however I get an error 400 message each time, without
any effect on the comments.

"JLatham" wrote:

One place to start is to post the code you are using and give us more
information about the problem you have encountered with the one particular
sheet. Also, explain what YOU expect the code to do.

"Ditto" wrote:

I have a large complex spreadsheet with 100's of comments that have
'spontaneously' taken on a variety of shapes and sizes. I applied VB code
(per Debra Dagleish) but get an Error 400 message when applied to this
spreadsheet. I have successfully applied the same macro to other
spreadsheets. Can someone help me identify the cause and implement a solution?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Please Help Error 400 when running tested code

I cannot duplicate your problem. I copied the code as published here and put
it into a module and it works fine (see note below), even on a sheet with no
comments at all, as it should.

One thing I did have to do to actually get any resizing done was change the
..Shape.TextFrame.AutoSize = True
statement to reverse the condition:
..Shape.TextFrame.AutoSize = False

and of course, I had to make the comment very wide before any change took
place, but with those in place, it worked fine for me in Excel 2003.

You might just delete the code entirely that you have and retype it into
either the same module again, or into a code module by itself and see if that
helps.

"Ditto" wrote:

The code I have tried to use is:

Sub Comments_AutoSize()
'posted by Dana DeLouis 2000-09-16
Dim MyComments As Comment
Dim lArea As Long
For Each MyComments In ActiveSheet.Comments
With MyComments
.Shape.TextFrame.AutoSize = True
If .Shape.Width 300 Then
lArea = .Shape.Width * .Shape.Height
.Shape.Width = 200
' An adjustment factor of 1.1 seems to work ok.
.Shape.Height = (lArea / 200) * 1.1
End If
End With
Next ' comment
End Sub

I was hoping that this would take all the comments in the worksheet and
resize them the same, however I get an error 400 message each time, without
any effect on the comments.

"JLatham" wrote:

One place to start is to post the code you are using and give us more
information about the problem you have encountered with the one particular
sheet. Also, explain what YOU expect the code to do.

"Ditto" wrote:

I have a large complex spreadsheet with 100's of comments that have
'spontaneously' taken on a variety of shapes and sizes. I applied VB code
(per Debra Dagleish) but get an Error 400 message when applied to this
spreadsheet. I have successfully applied the same macro to other
spreadsheets. Can someone help me identify the cause and implement a solution?

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Please Help Error 400 when running tested code

Yes, I have not had difficulties with the macro on other spreadsheets, just
the problematic one. Unfortunately your suggestions havent provided relief
either. Could the problem be with the original spreadsheet?

"JLatham" wrote:

I cannot duplicate your problem. I copied the code as published here and put
it into a module and it works fine (see note below), even on a sheet with no
comments at all, as it should.

One thing I did have to do to actually get any resizing done was change the
.Shape.TextFrame.AutoSize = True
statement to reverse the condition:
.Shape.TextFrame.AutoSize = False

and of course, I had to make the comment very wide before any change took
place, but with those in place, it worked fine for me in Excel 2003.

You might just delete the code entirely that you have and retype it into
either the same module again, or into a code module by itself and see if that
helps.

"Ditto" wrote:

The code I have tried to use is:

Sub Comments_AutoSize()
'posted by Dana DeLouis 2000-09-16
Dim MyComments As Comment
Dim lArea As Long
For Each MyComments In ActiveSheet.Comments
With MyComments
.Shape.TextFrame.AutoSize = True
If .Shape.Width 300 Then
lArea = .Shape.Width * .Shape.Height
.Shape.Width = 200
' An adjustment factor of 1.1 seems to work ok.
.Shape.Height = (lArea / 200) * 1.1
End If
End With
Next ' comment
End Sub

I was hoping that this would take all the comments in the worksheet and
resize them the same, however I get an error 400 message each time, without
any effect on the comments.

"JLatham" wrote:

One place to start is to post the code you are using and give us more
information about the problem you have encountered with the one particular
sheet. Also, explain what YOU expect the code to do.

"Ditto" wrote:

I have a large complex spreadsheet with 100's of comments that have
'spontaneously' taken on a variety of shapes and sizes. I applied VB code
(per Debra Dagleish) but get an Error 400 message when applied to this
spreadsheet. I have successfully applied the same macro to other
spreadsheets. Can someone help me identify the cause and implement a solution?



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Please Help Error 400 when running tested code

It very well could be something corrupted in either that particular worksheet
or workbook. You might try using File | Save As to write it to a different
file and hope that the new file doesn't have the problem. Or you could try
copying that one sheet to another workbook and seeing if it has the problem
in the new workbook. Use the Move/Copy option for the sheet and make a copy
into a new workbook, toss in the code into a module in it and try it out.

Otherwise, you may have to rebuild the sheet completely, and I know what a
pain that may turn out to be for you. Wish I had more to offer, but as you
know, the code is working with other sheets, it's working on another system
(mine) and so the problem would appear to narrow down to that one worksheet
itself.

One other thing to think about: does that problem sheet have any other Shape
objects on it? Think about 'drawing' objects such as ovals, rectangles,
point-outs, text boxes, etc. If so, perhaps one of them is confusing the
code - doesn't seem likely since the code should specifically be dealing with
Comment objects only, but it's something to think about as a remotely
possible maybe.

"Ditto" wrote:

Yes, I have not had difficulties with the macro on other spreadsheets, just
the problematic one. Unfortunately your suggestions havent provided relief
either. Could the problem be with the original spreadsheet?

"JLatham" wrote:

I cannot duplicate your problem. I copied the code as published here and put
it into a module and it works fine (see note below), even on a sheet with no
comments at all, as it should.

One thing I did have to do to actually get any resizing done was change the
.Shape.TextFrame.AutoSize = True
statement to reverse the condition:
.Shape.TextFrame.AutoSize = False

and of course, I had to make the comment very wide before any change took
place, but with those in place, it worked fine for me in Excel 2003.

You might just delete the code entirely that you have and retype it into
either the same module again, or into a code module by itself and see if that
helps.

"Ditto" wrote:

The code I have tried to use is:

Sub Comments_AutoSize()
'posted by Dana DeLouis 2000-09-16
Dim MyComments As Comment
Dim lArea As Long
For Each MyComments In ActiveSheet.Comments
With MyComments
.Shape.TextFrame.AutoSize = True
If .Shape.Width 300 Then
lArea = .Shape.Width * .Shape.Height
.Shape.Width = 200
' An adjustment factor of 1.1 seems to work ok.
.Shape.Height = (lArea / 200) * 1.1
End If
End With
Next ' comment
End Sub

I was hoping that this would take all the comments in the worksheet and
resize them the same, however I get an error 400 message each time, without
any effect on the comments.

"JLatham" wrote:

One place to start is to post the code you are using and give us more
information about the problem you have encountered with the one particular
sheet. Also, explain what YOU expect the code to do.

"Ditto" wrote:

I have a large complex spreadsheet with 100's of comments that have
'spontaneously' taken on a variety of shapes and sizes. I applied VB code
(per Debra Dagleish) but get an Error 400 message when applied to this
spreadsheet. I have successfully applied the same macro to other
spreadsheets. Can someone help me identify the cause and implement a solution?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
What are the most important Excel concepts I should know (will be tested soon)? DonaldCX Excel Discussion (Misc queries) 5 May 4th 23 07:41 PM
What are the most important Excel concepts I should know (will be tested soon)? DonaldCX Excel Discussion (Misc queries) 1 April 21st 06 02:05 AM
Automatically running code Richard Excel Worksheet Functions 1 February 7th 06 09:35 PM
Running code on a drop down selection change Steve Haack Excel Worksheet Functions 1 April 26th 05 05:03 AM
running code mark New Users to Excel 3 March 14th 05 09:14 AM


All times are GMT +1. The time now is 04:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"