Sunday, April 6, 2014

Simulated touch box in Excel for touch screen

I have a client that wants to build an Excel spreadsheet for use on a touch screen.  They would like to have about 15 columns of check boxes for about 600 rows. Reading articles about the check box controls for Excel, I was pretty sure I did not want to use them, for a few reasons:
  1. They're hard to create and associate with the cell if you need hundreds. If you copy and paste them, the underlying cell association isn't copied, so you'd have to manually click and set the cell for each one.  (Perhaps it could be programmed with VBA)
  2. Once you do get them all created and associated, deleting a row of the spread sheet doesn't delete the check box so it throws off all of the associations
  3. They are very small and can be hard to use and hard to see when printed
Instead, I started looking for a simulated solution.  What I really wanted was to handle the Click event for a cell and just set the text to X if it was empty, or empty if it was X.  Seemed simple enough.  First problem was that Excel does not provide a handler for the Click event.  The closest are BeforeDoubleClick and BeforeRightClick.  I wasn't sure how a right click would happen with a touch screen, but a double click sounded good enough.  So that's what I tried first.  I wrote my code and put it in the BeforeDoubleClick handler for the worksheet, and it worked great....for the mouse.

That brings up the second problem.  Touch events aren't handled the same as an actual mouse click.  Double tapping the screen did not create the same behavior as a double click, and it did not fire the BeforeDoubleClick event.  I needed to start looking at the other possible events to handle.  Eventually I tried SelectionChanged.  To select a single cell, you just click it once, or tap it once.  That's just what I needed.  I moved my code to that event and it worked great...for the mouse and touching!  I had to make one small change to ignore cases where multiple cells were selected, but that was trivial. The real catch is that you can't select a selected cell. So if you a click a cell to change its value, then you have to click somewhere else first before you can click/select that cell again.  We thought that was an acceptable catch since it would only be needed if the user accidentally clicked a wrong cell and needed to uncheck it.

Here's the final code for the event handler. The big If statement ensures that it isn't a multiple cell selection and ensures that its one of the cells that we want to use as a check box:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Cells.Count = 1 And Target.Row >= 20 And Target.Column >= 27 And Target.Column <= 40 Then
        If Target.Value = "" Then
            Target.Value = "X"
            Target.Value = ""
        End If
    End If
End Sub

Saturday, February 22, 2014

JavaScript include not working

The other day I was trying to include a JavaScript file in my HTML page, and I could not get it to work. I read several  posts about how to do it.  I was sure the path and syntax in the tag were right.  I had:

<script type="text/javascript" src="../scripts/scriptFile.js" />

 The page would still not recognize the functions in the file.  Well, turns out I didn't have the syntax exactly right.  Above, I was using the shorthand syntax for closing an empty tag.  I figured that since there was no content for the script tag itself, I could close it the short way.  Apparently, it is not allowed to use the short notation for closing the script tag.  After I changed to the code below, everything worked great!

<script type="text/javascript" src="../scripts/scriptFile.js"></script>

Once I found the solution (probably in a comment on Stack Overflow, I don't remember), then I found a whole article on the subject at Stack Overflow.

Tuesday, January 7, 2014

Free conference calls

More on the free products... another thing that came up recently for me was the need to set up a conference call.  I've written before about screen sharing software options, but in this case we didn't need to share any screen, just talk.  Of course I was hoping to find a free solution since this doesn't come up often for me and I didn't want to have to pay for a service subscription.

The first site I thought of was is what I currently use whenever I want to set up a screen sharing meeting.  It is free to host a meeting after downloading and running a small executable, and free to join a meeting without any extra software needed.  It's a great free screen sharing solution on both ends.  I know they used to provide conference phone numbers along with the meeting.  But it appears now that they only offer an online voice-over-IP solution that you can connect to from your computer.  So if you're at your computer anyway for a screen share meeting, then this would probably be the best solution.  You just tell your participants to click the phone icon to connect to the audio conference.

There are a couple reasons that I didn't want to use in this case though.  First, sometimes people have trouble with computer audio.  Some computers (like mine) do funny things with the mic, like default to a non-existent microphone, for example, that can cause some problems getting everyone audible.  Or people may forget they have computer speakers muted, or turned down, or may not want to use speakers in the office etc..  And second, as I mentioned, I didn't need the screen sharing, so seemed unnecessary to make everyone be at a computer instead of on our phones.

The other solution I found instead that turned out quite good was  It was free, provided an actual phone number that we could call into, and didn't even have any advertising, other than a small "Welcome to" or something like that.  Even more surprising is that I didn't even have to supply an email address because they have a "Guest Account" option.  Signing up and providing an email address does get you a few extra features, but the guest account worked great for us with three participants.  The only "catches", if you can call them that, are that it is not a toll-free number, and you can't schedule the call ahead of time.  With cell phones, I don't think anyone cares if its toll-free.  And I'm not sure what the advantage of scheduling ahead of time is, but probably its that you can send out the number a long time in advance.  I just started the call and emailed the number out a few minutes before the call started.  And of course, you could text it to someone if they didn't have easy access to email.

Free web site building tools

Someone asked me recently about building a web site for her business. My advice was that if it is a small personal business, then you can probably do well enough by using a free web site building tool. Of course if your business is bigger and you need something more unique, then you may have to move up to paying someone to design a custom site for you. That can cost many hundreds, or a few thousand, plus monthly hosting fees of $10 - $20 per month.  But for a small business, especially if its just a side business, I think the templates provided by free web sites are good. Here are the ones I recommend.

I think that the most widely used free site-building tool, and probably the best one, is Wordpress. You can build a free site by signing up for an account at By default, I think a Wordpress site really starts out as a blog, but they have a "Pages" feature so that you can add different pages to make it more like a normal site. There are lots of themes to choose from, they may even categorize them to highlight some for photography, not sure. The URL will be something like , but you can purchase a custom domain name through them for the normal price of something like $15/year

If you use a lot of Google products, then another option you might like is Google Sites. Almost exact same idea as Wordpress. Lots of themes, can buy custom domain if you want one. I'm not sure they have as many themes as Wordpress, but you still might find one you like better, who knows.

Another one I used to recommend is Weebly but I haven't used it in a long time since using the others more.