Nimble Coder

Adventures in Nimble Coding
posts - 76, comments - 39, trackbacks - 0

VB

Macro Guidelines for Excel VBA Beginners

I'm in the process of updating an Excel spreadsheet that is failing when it is running inside of Internet Explorer. The issue is related to the ActiveSheet and other global properties having a value of Nothing when the code is assuming they have valid references. As I am going through this spreadsheet, I am noting a wide variety of programming deficiencies and inefficiencies. Here is a list of some of the issues encountered: ...

posted @ Tuesday, May 27, 2008 6:28 PM | Feedback (0) | Filed Under [ VB Excel SharePoint ]

Throw Away Knowledge

I have spent the past hour trying to modify a VBScript / JavaScript utility to print out my password expiration date and it is driving me a little crazy. I cannot understand why something that should be so simple can be so blasted difficult. I have several account at client sites and the password expires periodically. In order to make sure I don't let the account lapse, I wanted to print the password expiration date. I had a version that worked before but the distinguishedName had to be exact. I used the adfind utility to figure out my distinguished name...

posted @ Tuesday, November 13, 2007 3:59 PM | Feedback (0) | Filed Under [ JavaScript VB ]

New Printers Breaking (Formerly) Stable Code!

I am almost embarassed to mention it, but in a past life I developed several major corporate applications using VB6. The applications are remarkably stable and have only been recompiled three or four times since their original deployment for various fixes or changes. This particular application has been in use for 10 years (since 1997) and uses Crystal Reports 5.0 for printing. Back in the day, I read Visual Basic Programmer's Journal (VBPJ) quite a bit and saw an article about using the Win32 API for Crystal Reports in VB. Since I was more of a C\C++ programmer thrust into...

posted @ Tuesday, August 07, 2007 10:14 AM | Feedback (0) | Filed Under [ VB ]

Formatting XML in Excel/VB

I was working on a spreadsheet that submitted XML data to a web service and the XML that was being generated by the XmlDocument object was not very tidy. Normally with C# I use Tidy.NET to clean up the HTML or XML, but since this was being used in Excel I didn't want to have any external dependencies. I found the following code online and it seems to work pretty well:Option Explicit ' http://www.vb-helper.com/howto_formatted_xml_document.html ' Add formatting to the document. Public Sub FormatXmlDocument(ByVal xml_doc As DOMDocument) FormatXmlNode xml_doc.documentElement, 0 End Sub ' Add formatting to this element. Indent it and add a '...

posted @ Wednesday, May 23, 2007 10:23 AM | Feedback (0) | Filed Under [ VB Excel ]

Visual Floating Point Debugger Tool

When I was debugging communication protocols a long time ago, I would often have to convert a 32-bit integer into a 32-bit floating point number. This did not mean using atof, fscanf, _fcvt or similar function, but rather interpretting the bits as an IEEE 754 or IEC 60559:1989 floating point number. An example would be: 1.0 == 0x3F800000 (1065353216) In the process, I wrote a tool that displays the components of the floating point number and allows you to change the raw hexadecimal bits. Here is a screen shot: This tool was written with VB6 however I have always wanted to make a C++/WTL...

posted @ Wednesday, February 07, 2007 1:10 PM | Feedback (0) | Filed Under [ VB Cpp ]

Export Excel Worksheet to ADO Recordset

This weekend I was working on a spreadsheet and I needed to save the data as a recordset. Unfortunately there didn't seem to be a way to do it easily without VBA macros. So I wrote this macro to save the current worksheet as an ADODB.Recordset XML file. Remember to add a reference to Microsoft.ActiveX Data Object 2.8 Library in the Excel Visual Basic Editor. Public Sub CreateAdoRecordsetXml() Dim rst As New ADODB.Recordset Dim sheet As Worksheet Dim col As Long, colcount As Long Dim row As...

posted @ Monday, January 15, 2007 12:22 PM | Feedback (0) | Filed Under [ VB Excel ]

Powered by: