Monday, September 21, 2009

Read File Properties with Excel VBA

The VBA script for Excel below will read the 'File Version' from the file properties and will read file name and its version each into a column in a Excel sheet.


Sub getFileProductVersion()

Dim objShell As Shell
Dim objFolder As Folder
Dim objFolderItems As FolderItems
Dim objFolderItem As FolderItem
Dim numberOfFiles As Long
Dim i As Integer
Dim j As Integer

Set objShell = New Shell
Set objFolder = objShell.Namespace("C:\Temp\files")

If (Not objFolder Is Nothing) Then
Set objFolderItems = objFolder.Items()
numberOfFiles = objFolderItems.Count
Range("A1").Select

For i = 0 To numberOfFiles - 1
Set objFolderItem = objFolderItems.Item(i)
ActiveCell.Offset(i, 0) = objFolderItem.Name
ActiveCell.Offset(i, 1) = objFolder.GetDetailsOf(objFolderItem, 39)
Next i

End If

Set objFolder = Nothing
Set objShell = Nothing

End Sub


Enjoy :)

How to specify the browser that should be used in WebTest

In WebTest it is possible to define which browser shall be simulated. Currently WebTest support the following browsers:
  • Firefox3 (or FF3)
  • Firefox2 (or FF2)
  • InternetExplorer6 (or IE6)
  • InternetExplorer7 (or IE7)
To get a more detailed list, have a look at the WebTest config page (http://webtest.canoo.com/webtest/manual/config.html).

As you can see in the simple example below, it is very easy to define the simulated browser for your test:







'Here goes your test code...'







This example is an extract from a browser test of the self test suite of WebTest. For more details, have a look a the self test suite (https://svn.canoo.com/trunk/webtest/selftests/).

Enjoy :)