Wednesday, September 25, 2013

C# designer.cs file is not updating correctly

In some cases you may end up with a designer.cs file which is missing control references or still has references to controls which have been removed from the front end display. I have had this happen from time to time and the fix that has generally worked for me is as follows:
Add another ASP control to the front end and save that file. The designer.cs should then fix itself.

Or alternatively:
Edit something on the front end and save that file. The designer.cs should then fix itself.

Thursday, September 5, 2013

Excel VBA - Print all Worksheets in a Workbook

A simple code snippet that can be used to print all Worksheets in an Excel Workbook is as follows:
Sub PrintAllSheets()
    Application.DisplayAlerts = False
         Dim WS_Count As Integer
         Dim I As Integer
         ' Set WS_Count equal to the number of worksheets in the active
         WS_Count = ActiveWorkbook.Worksheets.Count
         For I = 1 To WS_Count
            ActiveWorkbook.Worksheets(I).Select
               
            ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
            IgnorePrintAreas:=False
        End If
    Next I
End Sub