Recent Posts

Use VBA to find hidden Excel sheets

If you have hidden sheets in Excel, it might be helpful to programmatically manipulate those sheets.

Microsoft Excel

Use VBA to find hidden Excel sheets If you have hidden sheets in Excel, it might be helpful to programmatically manipulate those sheets. You might want to hide or unhide a sheet or just run an audit to make sure no one has changed your settings. The following sub procedure prints the visibility status of each sheet in the workbook:
Private Sub ReportVisibility()
'List very hidden sheets in Immediate window
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Visible = xlSheetVeryHidden Then
Debug.Print ws.Name & " is very hidden"
ElseIf ws.Visible = xlSheetHidden Then
Debug.Print ws.Name & " is hidden"
End If
Next
End Sub
  
Of course, you can modify this procedure to do most anything you want with the hidden sheets. Just add the appropriate code to the If statement.
This particular sub doesn't explicitly identify visible sheets. Anything not listed should be visible. If you want to see a comprehensive list of all sheets, add a condition for visible--xlSheetVisible.


Microsoft Word

10+ ways to recover a corrupted Word document If you've ever had an important document get corrupted, you know the despair that sets in. You've lost critical information and/or countless hours of work--or so it appears.
But hang on: You may not have to accept data loss. Here are some things you can try when you're dealing with a corrupted Word document.
1: Don't assume that the document is corrupt
Automatically assuming that a document is corrupt can be a big mistake. It could be Word or even Windows that is having the problem. Before you start trying to restore a backup or repair a file, try opening other documents.
Try opening your "corrupt" document from another computer. You may be surprised by what happens.
2: Make a copy of the document
This isn't really a recovery trick, but it is a crucial preliminary step. If you don't have a backup copy of the corrupt document readily available, make a copy of the corrupted file right away and store it on removable media. There's a chance that the corruption within the file could become worse over time or that you could destroy the file while trying to recover it.
Making a backup copy of the file now may save you even more heartache later on.
3: Check your email
In many cases, you may have e-mailed a copy of the document to someone at some point. If so, a copy of the document may still be in Outlook's Sent Items folder, attached to the email message you sent. Try selecting the Sent Items folder and using Outlook's Search feature to look for the document's name.
4: Run CHKDSK
Try running CHKDSK against the volume containing the corrupted file. Your problem could be caused by corruption at the file system level, and CHKDSK may be able to fix the problem.
If nothing else, running CHKDSK allows you to test the integrity of the file system, which allows you to determine whether the problem exists at the file system level or within the document itself.
5: Try exporting the file
If you can open the file in Word, try saving the file in an alternate format. Sometimes, using a format such as RTF or TXT will cause some of Word's codes to be stripped from the document, which often fixes the problem.
6: Extract the raw text
Although saving the Word document as an RTF or TXT file usually works pretty well, that technique does you no good if Word won't open the file. One approach is to use another word processor that supports Word documents. Alternatively, you can use a file editor (a hex editor) to manually extract anything salvageable from the file.
7: Use Word's text converter
You may also be able to recover the text portion of a document using Word's text converter. Click File | Open. When the Open dialog box appears, select the troublesome Word document. Then, choose Recover Text From Any File from the Files Of Type drop-down list and open the document. This filter will import straight ASCII text from any file.
You will lose Word formatting and nontext items such as graphics, but you should at least be able to extract most of the text information from the file. Note that this method is limited to documents in the Word 97-2003 format (not docx or dotx files).
8: Use Open And Repair
Word XP and later offer an Open And Repair option, which you can use to force Word to attempt a recovery. Just select the file in the Open dialog box and choose Open And Repair from the Open drop-down list in the bottom-right corner. This isn't necessarily foolproof, but it does work on a lot of problematic documents.
9: Use a Vista shadow copy of the document
Windows Vista automatically saves shadow copies of some files to the hard drive. If a shadow copy of your document exists, it may be possible to recover a recent version of the document.
To do so, right-click on the document and select the Properties command from the shortcut menu. When the document's properties sheet appears, select the Previous Versions tab. (This tab exists only for files stored on NTFS volumes.) The Previous Versions tab will show you any previous versions of the file that are available. For more on the shadow copy feature, see How do I… Configure and use shadow copy in Microsoft Windows Vista?.
10: Rebuild the file header
Although every Word document is different, Word documents that are created by a common version of Word have a common file header. I can't tell you exactly what this header contains, because it varies from one version of Word to the next. What I can tell you is that if you use a file editor to examine multiple known good Word documents, it will quickly become apparent which bits each of the documents has in common.
Once you have determined which part of the file is the header, you can copy the header bits from a known good document and use the editor to paste those bits into your corrupt document, overwriting the existing header in the process. If the header was the portion of the document that was damaged, this technique will fix the problem.
11: Use a recovery program
Several third-party applications on the market are designed to recover corrupt documents. One of the best known products is OfficeRecovery. Another popular product is Ontrack Easy Recovery. Data recovery products like these can have a hefty price tag, and depending on the extent of the damage, they may or may not actually be able to repair your file.


Microsoft Access

Add a secondary sort column to an Outlook sort You probably know that you can sort Outlook items by clicking a column title. Clicking toggles between ascending and descending order.
What you might not know is that Outlook doesn't limit you to a single-column sort. To sort by two columns, sort the primary column. Then, hold down the [Shift] key and click the column cell that represents the secondary sort group.
In the figure below, the small up arrow indicates an ascending sort on the From column.

The secondary sort, shown below, adds a descending sort by size, as indicated by the small down arrow. The difference is subtle. Only the two messages in the first group resort--sorting the 9 KB message before the 6 KB message.