Deciding what function to use at runtime in VB

Good coding practice in VBA (or Visual Basic itself) suggests that you should use functions and subroutines rather than one big long list of code. However, sometimes you may not know in advance the name of the procedure you want to call. This is a problem because you can't use a variable to call a function.

Actually, you can. Just use the "run" method. As an illustration of how it works, the following 2 bits of code do the same thing, both calling the function func1. The difference is that in the second one we didn't have to decide on the function to run before the code started running.

Faking page headers on a Microsoft Access subreport

In a tedious Microsoft Access report featuring pages and pages of meaningless numbers in a table you quite often want the table headings (the bit labelling the column) to repeat itself at the top of each page. That way the recipient has no excuse for not knowing what a hundred pages of mind-bogglingly dull numbers mean.

Normally Access provides a Page Header section of the report for exactly this purpose. If you can't see it then in the report design view, go to the View menu and select "Page Header/Footer". Whatever you write in this section will appear at the top of each page.

Breaking WEP for novices - more wifi insecurity

Having dealt with faking MAC addresses in a previous article, the Poorhouse heard on the grapevine that it wasn't so difficult to beat the other side of bog-standard wireless network security either; the encryption key.

When a wireless network client talks to an access point (for instance a router) it transmits packets of data. These packets could potentially be intercepted by a nefarious individual sitting nearby by virtue of the fact they are flying through the air for all to see. They could then feasibly see what the network user is up to, or sneakily communicate with their network, use their Internet connection and so on. Therefore wifi networks with a semblance of security use encryption so a passer-by cannot see what is going on with the network or understand any of the packets being transmitted around it. Typically this may be done with "Wired Equivalency Privacy" (WEP), which is often the only option open to users of older or cheaper equipment. The Poorhouse knows for sure that both home users and perhaps more worryingly business users use it regularly.

Faking your MAC address

Most network hardware, be it in a computer, a PDA or a component, has a Media Access Control (MAC) address associated with it. This is a unique number, often written in the format 00-00-00-00-00-00, that is permanently assigned to one exact piece of network equipment. From it you can work out such things as what company made it and so on.

More critically it is often used as at least one part of network security with regard to wireless networks. This, combined with the (usually WEP) encryption key that the other part of "bog-standard" wifi security, does indeed sound like a very good idea insomuch as someone wanting to access that particular network would need a specific piece of hardware (identified by its MAC address) and a specific piece of knowledge (the encryption key). Indeed this is the upper limit of security that many older or cheaper network set ups have available to them.

How to be even lazier

How many nights have you laid awake wondering how can i expend even less energy surfing the net?
Well worry no longer because firefox has done it again.

All-in-one gestures is a firefox extension that allows you to control the web browser without all that pesky moving to click a button.

You simply hold down the menu button on the mouse and draw a litle line and it translates the little line and does what you want. For example a line travelling left would take you back a page and a line travelling forwards would take you forward a page. Up and left or right to navigate through the tabbed windows.

Reduce web irritation: Mailinator and Bugmenot

Heavens above, more ways to avoid web and email irritation. The Poorhouse is most frustrated when, before viewing some web page or downloading a file where the content is free and open to the public, your email address is demanded. Worse yet when you can't just type nonsense in as you then have to go check it in order to click on a link to confirm you are a real person - who can be sent adverts for Viagra.

It is often acceptable to demand some confirmation that you actually exist and are contactable in circumstances where you are going to be publishing content or paying money (for instance a web forum, or subscriber-only content) but for idle browsing it is just downright irritating to have to fill in a form, go check your email and so on for ostensibly no good reason - other than to let the site owner have your email address so they can email you "special offers" and the like.

Using .iso CD images in Windows

Simplistically, an .iso file is an exact image of a CD or DVD. It is a useful file format for distributing the equivalent CDs over the Internet or making backups of your software. The only problem is more often than not you will be wanting to recreate a "real" data CD from an .iso file and if you're running Windows (XP) it doesn't have anything built in to it to do that. Copying an .iso file onto a CD as though it was just any other file will not work; you just get a CD with an iso file on and not a recreation of the original CD.

JAlbum - static web photo album software that is actually good

JAlbum: Box, camera and screen not includedJAlbum: Box, camera and screen not includedIn these Net 2.0 days of flickr, Imageshack, Yahoo photos and so on, it might seem like it's never been easier to publish your home snaps. That's probably because it's true. However, easy doesn't always equal perfect. Sometimes you might want to have a web-traditional photo gallery on your own website, so you have full control over addresses, formatting, content, size and so on.

Winmail.dat annoyances

Ever received a mostly-blank email that contained an attachment called "winmail.dat"? Or maybe you sent one and cursed the foolish recipient for gibbering on about some winmail.dat file when you know you didn't attach such a thing.

If so, no hallucinations necessarily took part in that experience. It's another treat from the Microsoft guys. On occasions Microsoft Outlook will try and send the message all nice and pretty in some weird-ass Microsoft Transport Neutral Encapsulation Format (MS-TNEF) that not much else understands. This is an attempt to convey formatting information such as fonts, colours and all the rest of the modern jiggery-pokery that largely is a distraction from the actual content of the email. If the recipient's program doesn't understand what MS-TNEF is (i.e. it isn't Outlook) that the formatted version comes as an attachment called winmail.dat. No big deal - except that if you have deliberately attached a file to the email (e.g. a PDF file, a Word file and so on) then that is also hidden inside the MS-TNEF winmail.dat file and as such any programs that don't do the MS-TNEF malarkey can't even see the attached file, let alone open it.

docmd.transfertext doesn't work so well either

Undeterred by the previous significantly buggy annoyance of docmd.transferspreadsheet, the Poorhouse was commanded to transfer some more facts 'n' figures; this time in the ultimate old-skool format, a flat text file. The info within was to be featured in a Microsoft Access table.

In order to transfer data from a text file - for example a comma separated values (csv) file or a fixed length file – Access VBA includes the command TransferText. The syntax is as follows:
TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage)

Syndicate content