What I’ve been consuming
I'm listening to...Jars of Clay - The Long Fall Back to EarthMay 2009Random Quote
Whole damn state's goin' apey
- FrenchThe archive
Categories
Tags
ABC This Week AWS ColdFusion COM Dylan faith George F. Will home maintenance hubris Is It My Code Or Is It A Bug Java linux newbie ListQualify Meet the Press Microsoft N.T. Wright Palm PDA PHP podcasts pynchon reading Ron Coulter security Spy Sweeper Stack Overflow Technology the blog VBA Virtual PC WordPress XML XSL
Hilarious web site
Posted in Internet
Leave a comment
Now running WP3.0
Just made the upgrade to WordPress 3.0 with no problems.
How can I say no to a version named “Thelonious”?
Posted in the blog
Comments Off
Finished: The Swan Thieves
The Swan Thieves: A Novel by Elizabeth Kostova
My rating: 2 of 5 stars
This book is far longer than it needed to be. After page 100, I completely skipped all the 18th century France scenes. The book is filled with just the kinds of characters you’d expect to meet in an MFA creative writing assignment: Marlow, the psychoanalyst who (of course) fails to psychoanalyze himself; Marlow’s father, the judge-not-lest-ye-be-judged milquetoast of a retired cleric who (of course) diagnoses his son’s problems; the tortured artist Robert Oliver.
Robert meets the two main female characters in obnoxious meetcute scenes that would have been cut out of any self-respecting Hollywood B-movie slated for a Thanskgiving release. The female characters are strong, and the ending is satisfying. But the descriptions of Robert’s relationships go on far too long. In a development that ultimately leads nowhere, we even meet Robert’s wife’s mother (of course, this is all to show the difficulties of life in the sandwich generation.)
Posted in Books
Comments Off
Dumping file info into an Excel spreadsheet
So you’ve got a folder full of documents and you want to know what’s in the folder, how big the files are, and when they were last modified? And of course you want to be able to filter and sort the list. And throw in a spiffy GUI to get your base folder!
How about a little recursive Excel macro that will do the job for you? Before Office 2007 came along, I had a macro that used Application.FileSearch to do the job. But that is apparently no longer supported. You need the FileSystemObject.
So create an Excel workbook with macros enabled (i.e., ending with .xslm)
Open your VB window, go to Tools > References… and check the Microsoft Scripting Runtime option. If you don’t see it listed, click Browse and navigate to C:\Windows\System32\scrrun.dll
Create a macro and paste the following code
Sub myFileSearch()
Dim objFSO As Scripting.FileSystemObject
'Dim myFSO As FileSearch
'Dim myFSO As String
Dim foundFile As String
Dim myofficeobject As Object
Dim myfilename As String
Dim objFolder As Folder
Dim objFile As File
Dim GetLookIn As String
Set objFSO = New FileSystemObject
GetLookIn = BrowseFolder("Where do you want to search?")
If GetLookIn = "" Then
Exit Sub
End If
Set objFolder = objFSO.GetFolder(GetLookIn)
For Each objFile In objFolder.Files
myfilename = objFile.Path
ActiveCell.Value = myfilename
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = FileDateTime(myfilename)
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = FileLen(myfilename)
ActiveCell.Offset(1, -2).Select
Next objFile
ShowSubFolders objFolder
End Sub
Public Function ShowSubFolders(ByVal Folder As Variant)
Set objFSO = New FileSystemObject
For Each Subfolder In Folder.SubFolders
Set objFolder = objFSO.GetFolder(Subfolder.Path)
Set colFiles = objFolder.Files
For Each objFile In colFiles
myfilename = objFile.Path
ActiveCell.Value = myfilename
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = FileDateTime(myfilename)
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = FileLen(myfilename)
ActiveCell.Offset(1, -2).Select
Next
If Len(Subfolder) Then
ShowSubFolders Subfolder
End If
Next
End Function
Here’s the code for the GUI
'************** Code Start **************
'This code was originally written by Terry Kreft.
'It is not to be altered or distributed,
'except as part of an application.
'You are free to use it in any application,
'provided the copyright notice is left unchanged.
'
'Code courtesy of
'Terry Kreft
Private Type BROWSEINFO
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias _
"SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32.dll" Alias _
"SHBrowseForFolderA" (lpBrowseInfo As BROWSEINFO) _
As Long
Private Const BIF_RETURNONLYFSDIRS = &H1
Public Function BrowseFolder(szDialogTitle As String) As String
Dim X As Long, bi As BROWSEINFO, dwIList As Long
Dim szPath As String, wPos As Integer
With bi
.hOwner = hWndAccessApp
.lpszTitle = szDialogTitle
.ulFlags = BIF_RETURNONLYFSDIRS
End With
dwIList = SHBrowseForFolder(bi)
szPath = Space$(512)
X = SHGetPathFromIDList(ByVal dwIList, ByVal szPath)
If X Then
wPos = InStr(szPath, Chr(0))
BrowseFolder = Left$(szPath, wPos - 1)
Else
BrowseFolder = vbNullString
End If
End Function
'*********** Code End *****************
Export Microsoft Outlook Journal entries to Excel
If you’re a Microsoft Outlook Journal user, save this code into a macro to export journal entries from a select time range into Excel.
Updated for Excel 2007. In your macro window, under Tools>References, make sure you check the Microsoft Excel 12 Object Library and Microsoft Access 12 Object Library.
Sub exportjournal()
''
''Created 4/4/08
''Source: Programming Microsoft Outlook 2000 by Ken Slovak
''Had to add references to Microsoft Excel 11 and Access (for the Nz function)
'' also see http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnaro97ta/html/sampauto.asp
''Works!
Const strNone As String = "No journal items."
Const strTitle As String = "Export"
Dim appOL As Outlook.Application
Dim nmsNS As Outlook.NameSpace
Dim fldFolder As Outlook.MAPIFolder
Dim itmItems As Outlook.Items
Dim itmJournal As Outlook.JournalItem
Dim appExcel As Excel.Application
Dim wbkBook As Excel.Workbook
Dim wrkSheet As Excel.Worksheet
Dim rngRange As Excel.Range
Dim lngCount As Long
Dim intReturn As Integer
Dim intRow As Integer
Dim strRange As String
Dim strWorkBook As String
Dim strUNI As String
Dim begindate As Date
'Set a reference to the default Journal folder
Set appOL = CreateObject("Outlook.Application")
Set nmsNS = appOL.GetNamespace("MAPI")
Set fldFolder = nmsNS.GetDefaultFolder(olFolderJournal)
Set itmItems = fldFolder.Items
lngCount = itmItems.Count
If lngCount = 0 Then
intReturn = MsgBox(strNone, , strTitle)
Exit Sub
End If
'Get date from user
begindate = InputBox("Enter Begin Date")
EndDate = InputBox("Enter End Date")
strWorkBook = "C:\foldername\JournalExport.xls"
'Initialize Excel items
Set appExcel = CreateObject("Excel.Application")
appExcel.Workbooks.Open (strWorkBook)
'Activate Sheet 1
Set wrkSheet = appExcel.ActiveWorkbook.Sheets(1)
wrkSheet.Activate
appExcel.Visible = True
'Set Sheet column widths
wrkSheet.Columns("A").ColumnWidth = 20
wrkSheet.Columns("B").ColumnWidth = 20
wrkSheet.Columns("C").ColumnWidth = 16
wrkSheet.Columns("D").ColumnWidth = 20
wrkSheet.Columns("E").ColumnWidth = 50
'The example in the book
'has a bunch of formatting code that I am ignoring
'Start adding data at Column A, Row 1
intRow = 1
strUNI = "A"
For Each itmJournal In itmItems
With itmJournal
'adjust date as needed
'If itmJournal.LastModificationTime > begindate And itmJournal.LastModificationTime < EndDate Then If itmJournal.Start > begindate And itmJournal.Start < EndDate Then
'Subject
strRange = strUNI & CStr(intRow)
Set rngRange = wrkSheet.Range(strRange)
rngRange.Value = nz(.Subject)
'start time
strUNI = Chr(Asc(strUNI) + 1)
strRange = strUNI & CStr(intRow)
Set rngRange = wrkSheet.Range(strRange)
rngRange.Value = nz(.Start)
'Duration
strUNI = Chr(Asc(strUNI) + 1)
strRange = strUNI & CStr(intRow)
Set rngRange = wrkSheet.Range(strRange)
rngRange.Value = nz(.Duration)
'Categories
strUNI = Chr(Asc(strUNI) + 1)
strRange = strUNI & CStr(intRow)
Set rngRange = wrkSheet.Range(strRange)
rngRange.Value = nz(.Categories)
'Notes = body(?)
strUNI = Chr(Asc(strUNI) + 1)
strRange = strUNI & CStr(intRow)
Set rngRange = wrkSheet.Range(strRange)
rngRange.Value = nz(.Body)
'Back to column A, next row
strUNI = "A"
intRow = intRow + 1
End If
End With
Next itmJournal
Exit Sub
ExportJournal_Error:
MsgBox "Error #" & Err.Number & Err.Description
End Sub
Yet another example of Apple’s hubris
I just discovered that iTunes has an affiliates program like Amazon’s.
But right off the gate they’re asking for my Social Security number?!
Not a chance.
Snowblower summerized
Added fuel stabilizer to the snow blower today
Note to self
Come back to this post when ready to move the blog
Racial epithets or epitaphs
I already noted how Michael Steele said “racial epitaphs” when he clearly meant “racial epithets.” Now Doris Kearns Goodwin seems to have committed the same blunder. Listen to the NBC Meet the Press podcast from 3/28/10 at 35:48
Michael Steele gaffe on MTP?
Did RNC Chairman Michael Steele condemn “racial epitaphs” or “racial epithets” on NBC’s Meet The Press on 3/21/10? If you listen at 27:40 on the Podcast, it sounds like he says “epitaphs.”