Calendar

September 2010
S M T W T F S
« Aug    
 1234
567891011
12131415161718
19202122232425
2627282930  

Categories

Creating an Excel document from MS Word

I have just come across the need to create an Excel workbook from a MS Word macro. I have simplified this code for the blog to simply move all text from Word into a new Excel workbook. This will provide a solid starting point for future use.

Option Explicit

Public Sub FormatInExcel()

On Error GoTo Err_Handler

Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
Dim oSheet As Excel.Worksheet
Dim oRng As Excel.Range
Dim oDoc As Object

Set oDoc = ThisDocument

‘ Start Excel and get Application object.
Set oXL = CreateObject(“Excel.Application”)
oXL.Visible = True

‘ Get a new workbook.
Set oWB = oXL.Workbooks.Add
Set oSheet = oWB.ActiveSheet

‘ Do work
oDoc.ActiveWindow.Selection.WholeStory
oDoc.ActiveWindow.Selection.Copy

oSheet.Range(“A1″).PasteSpecial xlPasteValues

‘ Release object references.
Set oRng = Nothing
Set oSheet = Nothing
Set oWB = Nothing
Set oXL = Nothing
Set oDoc = Nothing

Exit Sub

Err_Handler:
MsgBox Err.Description, vbCritical, “Error: ” & Err.Number

End Sub

Happy coding!

Multiple ASP.NET Virtual Directories on One Web Site Server

I have made a discovery this morning while attempting to configure two ASP.NET Virtual Directories on one Web Site Server.
The server houses IIS6 and is hosting several web applications for our QA group. IIS is responsible for hosting our ScrewTurn Wiki and an internal metrics gathering tool. The Wiki was built using the .NET Framework version 2 and the Metrics site using the .NET framework version 4. It turns out that if one web site is hosting two virtual directories, that ALL virtual directories for that site MUST use the same version of the .NET Framework.
To solve our issue, I created a seperate Web Site in IIS, running on a seperate port, to run our wiki site.

During our troubleshooting, we discovered this page and found it extremely useful as well: http://neilkilbride.blogspot.com/2008/02/windows-2003-iis-returns-404-for-aspnet.html

Changing “Save As” Defaults in Office 2007

For those of you currently using Office 2007 in an office environment, you may have found yourself in the position where you have the latest version of Office and others around you still run with previous versions. Saving documents in the new Office 2007 format usually prevents those users from being able to access your documents. You can always do the “Save as” routine of converting the document to Office 2003, but I sometimes forget to do that. If you want to make this the default behavior of Office 2007, you can do the following:

  1. Click on the round “Office Button” at the top left of Word 2007 (or other Office applications).
  2. Then, at the lower right of the window that appears, click on “Word Options.”
  3. In the next screen that comes up, click on “Save” in the column at the left.
  4. In the panel that appears at the right, you’ll notice an option called “Save Files in this format,” with a drop-down list of choices next to it.
  5. Display the list of choices by clicking on the arrow and select “Word 97-2003 Document (*.doc)”.
  6. Click OK at the bottom of the window.

You should now be set up to always save documents in the 2003 format.

Issue installing MS Fax Services in Windows XP SP3

I recently came across an issue where I needed MS Fax Services installed to test a particular scenario for the enterprise system I am working with. Apparently, in Windows XP SP3, the security database can be corrupted in such as way as to prevent you from installing certain services, including MS Fax Services. From http://support.microsoft.com:

You cannot add a Windows component in Windows XP

When you try to add a Windows component after you first install Microsoft Windows XP, you cannot add the component, and you may receive a message that is similar to the following:
Files Needed
The file ‘file_name’ on Windows XP Professional CD-ROM is needed.
Type the path where the file is located, and then click OK.

This problem occurs even though the file already exists in the C:\Windows\I386 folder. When you provide the path of the file, the error message reappears.

This problem occurs when you try to install one or more of the following Windows components:

  • Accessories and Utilities
  • Fax services
  • Indexing Service
  • Internet Explorer
  • Internet Information Services (IIS)
  • Management and Monitoring Tools
  • Message Queuing
  • MSN Explorer
  • Networking Services
  • Other Network File and Print Services
  • Outlook Express
  • Update Root Certificates
  • Windows Media Player
  • Windows Messenger

This page also provides you a link to a potential hotfix resolving this situation. Unfortunately for me, the Service Pack I have installed had a more recent copy of this this “hotfix”, so it wouldn’t install. Reading further down this page provides another glimmer of hope: Rebuilding the Security Database. The good ol’ fashioned reset button…

ESENT event IDs 1000, 1202, 412, and 454 are logged repeatedly in the Application log

To resolve this issue, use the procedure described in this section to re-create the local Group Policy file.

Important Implementing a security template on a domain controller may change the settings of the Default Domain Controller Policy or Default Domain Policy. The applied template may overwrite permissions on new files, registry keys and system services created by other programs. Restoring these policies might be necessary after applying a security template. Before performing these steps on a domain controller, create a backup of the SYSVOL share.

Note When you use the following procedure, your computer is returned to the original installation state where the Local Security Policy is not defined. You may have to start your computer in Safe mode to rename or move files. For additional information about how to do this, see Windows 2000 Help.

1. Open the %SystemRoot%\Security folder, create a new folder, and then name it “OldSecurity”.
2. Move all of the files ending in .log from the %SystemRoot%\Security folder to the OldSecurity folder.
3. Find the Secedit.sdb file in the %SystemRoot%\Security\Database folder, and then rename this file to “Secedit.old”.
4. Click Start, click Run, type mmc, and then click OK.
5. Click Console, click Add/Remove Snap-in, and then add the Security and Configuration snap-in.
6. Right-click Security and Configuration and Analysis, and then click Open Database.
7. Browse to the %TEMP% folder, type Secedit.sdb in the File name box, and then click Open.
8. When you are prompted to import a template, click Setup Security.inf, and then click Open.
9. Copy %TEMP%\Secedit.sdb %SystemRoot%\Security\Database.

Sounds daunting, but this is really straightforward… Regardless, be sure to backup the necessary files before doing this, or get some help from a tech-savvy friend or from Microsoft proper.

After performing these steps, I was able to install MS Fax Services. Hopefully this will help some of you out.

QuickTest Pro Asset Upgrade Tool for QualityCenter 10

My office has recently upgraded to QualityCenter 10, as several members of our team were having issues connecting to QC9 using Internet Explorer 8 with Windows XP SP3. This was as good a reason as ever to switch.

We have been automating our smoke test suite in QuickTest Pro 9.5 over the past year and have recently upgraded to QTP10. The integration of QTP10 to QC9 was seamless and we had experienced no issues executing older scripts in the newer version of the tool. Of course, once we edited an older script, it was upgraded to the latest version. This is understandable.

Once we upgraded to QC10, however, we started experiencing some trouble. All of our prior scripts had started to fail due to external script references not being found. Also, many scripts couldn’t find the associated object repository. This caused some minor panic in our team: potential lost work, hours of required rework, etc.

We next attempted to edit our scripts in order to debug and figure out what we would have to do to fix these issues. That’s when we saw this message:

QTP Upgrade Warning

This is the first time I had heard of the QuickTest Pro Asset Upgrade Tool for QualityCenter. After doing some research, it was determined that this tool was included on the QualityCenter 10 Installation DVD.

The purpose of this tool is to upgrade all QTP scripts currently in your QualityCenter project. You will need to login to your project as a project admin and this tool must run on a machine that has QuickTest Pro 10 installed. There is another important step that took me a bit to figure out, mainly because I failed to read the documentation.

Your local QuickTest Pro installation must have the folder pathing setup to find all external references your scripts may use. This includes paths (in and out of QC) for shared object repositories, function libraries, and other scripts. If this is not set up, the Asset Upgrade Tool will not be able to process your scripts. To set up your folder pathing, in QTP go to Tools –> Options –> Folders.

Executing the upgrade tool is very straightforward, but please read the documentation carefully. The general process is to login to your project, analyze your project, then upgrade your project. It presents a full report of the analysis and upgrade process for your review.  It is highly recommended that you make a backup of your project before your upgrade, as you never know what may happen. The upgrade process is done on an active project, which is different than many other QC upgrade tasks. That being said, ensure that no one is accessing the project while the upgrade is running.

Once we had everything set up correctly and processed the upgrade, we found that we were now able to open our older scripts to edit in QTP10. We were also able to execute the scripts without error.

Universal Cell Phone Chargers

This is great news for consumers of cell phones! Major players in the market have decided that they’ll switch to a universal charging mechanism by January 2012. The switch will reduce the sheer amount of plugs that we all collect, plus will reduce the amount of waste we create due to obsolete technology. I welcome this move because I won’t have to worry about finding the right plug for my cell, I’ll just use yours!

Read on:

Universal Chargers to Finally Become a Reality – PC World

An initiative backed by both mobile phone manufacturers and operators
will result in a universal charger based on the Micro-USB interface for
new mobile phones.

Moving to a universal charger will be a boon for both users and the environment by reducing the amount of waste, since fewer chargers have to be thrown away. It will make life a lot easier for users, who will be able to charge their mobile phones using any available charger, and when they buy a new phone they won’t have to get a new charger.

The group agreed that by the January 2012, most mobile phones will support the universal charger, according to the GSM Association, which is leading the initiative.

Members on the phone and chipset side include LG, Motorola, Nokia, Qualcomm, Samsung and Sony Ericsson.

Members on the operator side include 3 Group, AT&T, KTF, Mobilkom Austria, Orange, Telecom Italia, Telefónica, Telenor, Telstra, T-Mobile and Vodafone.

MSCONFIG – Configure your Windows Startup

I keep forgetting the application that allows me to configure how Windows XP boots. The application is MSCONFIG.exe.  To start, launch a run prompt and type:

MSCONFIG

Use this tool at your own risk, as you are directly modifying important system files.

Divx Files on Zune

I was recently looking for a way to enjoy Divx-encoded videos on my Zune — you know for road trips and such. Apparently some work has been done in this field, yet I have had little success in duplicating the effort.

The folks over at Techmixer.com have suggested the following steps:

  1. Copy and paste the following lines into a text edit program and save it under .reg extension.

    Windows Registry Editor Version5.00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Multimedia\Zune\Extensions\.avi]
    “Extension.Handler”=”Microsoft.Zune.1.AVI””MediaType.Description”=”Video Clip”
    “MediaType.Icon”=”C:\\Program Files\\Zune\\ZuneLoc.dll,-736?”Extension.MIME”=”video/avi””AlreadyRegistered”=”no”
    “Runtime”=dword:00000007?PerceivedType”=”video”
    “Permissions”=dword:0000000f
    “UserApprovedOwning”=”no”
    @=””

  2. Double-click the newly .reg file and the register information will be added to your registry.
  3. Restart Computer
  4. After restart, you start dragging your divx movies using Zune software into your zune player. The files will synced with Zune devices and force the zune software to convert the files.

You may have to locate a file called “zuneloc.dll” for this to work too…

It is important to note that your mileage may vary with this and to proceed at your own risk. You will be mucking around in the registry, which can do serious harm to your computer. And, I’ve not tried this out yet, so be warned… I am just passing along what information I have found so far.

My Blog’s Graph

I was reading Griner’s Blog over at TheSocialPath.com and his latest post had an interesting image of a graph the blog. Of course, I got curious and decided to graph out my blog using this cool web page graphing site:

Webpages as Graphs

I am not sure what exactly it all means, but it sure looks purty.

Updating ActiveX Datagrids in QTP

In my recent testing efforts, I have comes across a desktop windows form (written in VB6) involving updating a data grid and then calculating another field’s value based on those updates. In order to achieve this functionality, the development staffs implemented two events (AfterColUpdate and LostFocus) that, when triggered, would fire off the calculation method.

None of this is obvious to the end user when testing, all they see is enter a number into the grid column and the total field automatically updates with the sum of all values in the column. Easy peasy.

I created my reusuable action in QuickTest Pro and record the entering of data, which yielded the following code:

VbWindow(“frmMain”).VbWindow(“frmChildWindow1″).VbWindow(“frmChildWindow2″).AcxTable(“PaymentGrid”).SelectCell 1,4

VbWindow(“frmMain”).VbWindow(“frmChildWindow1″).VbWindow(“frmChildWindow2″).AcxTable(“PaymentGrid”).SetCellData 1,4, “30.00″

Continue reading Updating ActiveX Datagrids in QTP