SharePoint 2007 – Unable to edit, delete or close the Content Editor Web Part

The error was caused by the content in the Content Editor Web Part on the page.  This had been copied and pasted to another Content Editor Web Part on the same page and it has brought across some CSS script with it.
This causes the error, but because of the error we cannot delete the web part through the web part’s menu, we can go to the link:  http://server/yourpage.aspx?contents=1, here it will list out all the web parts on the page, you can now delete or hide the failing web part.

Content Editor Web Part Tips and Tricks

  • In the Rich Text Editor, use the buttons on the toolbar for formatting, adding tables, hyperlinks, and images.
  • Images: Upload your image to your site before attempting to add an image to the Web part. Once you’ve uploaded your image to the site, you can add the image to the Web part by clicking the Image button (or CTRL+SHIFT+G) and click browse to find your image on the site. Then, you can choose how to display the image within the text. For example, under Alignment in the Edit Image Properties dialog box, choose Left to place the image to the left side of the text (as in the screenshot shown above). To add space between the image and the text, add a number under Horizontal Spacing (pixels) or Vertical Spacing (pixels). I always start with 10.
  • Styles: Want to use predefined styles? Don’t click the Styles button. Instead, click the paragraph mark button and select a style such as Bulleted List, Heading 1, Heading 2, and so on.
  • So what is the Styles button for? I use it when I paste content into the Rich Text Editor from another source, and it doesn’t look quite right. So I click Remove Inline Styles under Styles to remove stray formatting brought in from the other source, and then reformat the text in the Rich Text Editor.
  • Title (Chrome): When you’re using the Content Editor Web Part to display a heading, you might not want the Content Editor Web Part title to show. To remove it, expand the Appearance section in the tool pane, and under Chrome Type, select None or Border Only.
  • Height and Width: You can specify a height and width for the Web part by expanding the Appearance section and clicking Yes under Height or Width, and then entering the size you want. You can choose to represent the size in Pixels, Inches, Points, and more.
  • Editing the HTML: If something just doesn’t look right and you can’t change it using the Rich Text Editor, you may need to edit the HTML directly. You can do this by clicking the Edit HTML Source button in the Rich Text Editor, or by closing the Rich Text Editor and clicking the Source Editor button in the tool pane. In cases where there is a lot of HTML to work with, I copy the HTML out into Notepad where I can wrap the text and use the Find tool to find what I’m looking for, make my changes, and then copy it back into the Source Editor. For especially complex HTML, I will copy the code into SharePoint Designer and work with it there.