How to stop in Excel automatic conversion from text to hyper links with formatting style?

I know that this feature is good in most cases, but I work on report creation and I have problem with long domain names when I want to print document.

UPD: This is for automatically generated reports from XML data source into Excel and then PDF.

Excel 2003 format is most simple to do it with XSL(T)

migrated from stackoverflow.com Jun 21 '11 at 11:52

This question came from our site for professional and enthusiast programmers.

  • 1
    It's hard to know how to answer your question usefully when you don't fully specify your problem up front. Please do so in the body of your question. New requirements appear in your comments to the various answers: you're not allowed to change the AutoCorrect options manually; it has to be in Excel 2003 XML format... All this should be stated up front in your question (clearly edit later if necessary), otherwise it's rather frustrating for the people trying to answer properly. Now is there anything else you need to tell us regarding this problem? – Jean-François Corbett Jun 21 '11 at 11:58

Excel 2003

Go to Menu Tools > Autocorrect Options. Select the AutoFormat As You Type tab. Uncheck the box for adding hyperlinks. This will stop Excel from putting the hyperlinks in the first place. Find more information here.

Excel 2007/2010

Click the Microsoft Office Button, and then click Excel Options.

The Excel Options button is located in the lower part of the menu that opens after you click the Microsoft Office Button . Click Proofing. Click AutoCorrect Options. Click the AutoFormat As You Type tab. Select or clear the check boxes for the options that you want to enable or disable.

With VBA

Solution with VBA Event on Worksheet_Change (Excel 2000 but can be adapted to any higher version)

  • I can't use Excel options. This should be automatically generated report for customer. – Eir Nym Jun 21 '11 at 8:17
  • Can you please elaborate ? Are you prevented from accessing Excel options ? – JMax Jun 21 '11 at 8:37
  • Yes, I can change Excel options on my computer, not customer's – Eir Nym Jun 21 '11 at 10:56

In Excel-VBA:

Application.AutoFormatAsYouTypeReplaceHyperlinks = False

You could put this in the Workbook_Open event so that this happens automatically when the user opens the workbook.

Private Sub Workbook_Open()
    Application.AutoFormatAsYouTypeReplaceHyperlinks = False
End Sub
  • How can I embed this in Excel 2003 XML format? – Eir Nym Jun 21 '11 at 10:57

I've found official documentation about Excel XML format. There's attribute x:Ticked="1" for ss:Data which prevents cell automatic format.

  • That's x:Ticked. – Jean-François Corbett Jun 21 '11 at 11:48
  • As far as I can tell, that's not what x:Ticked="1" is for, and it will not prevent automatic formatting when the user inputs a new value in the cell. – Jean-François Corbett Jun 21 '11 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.