When Scripting.Dictionary keys wont die!!!

I’ve just spent 2 hours debugging an amazing bug. At least I think its a bug.

I am using a Scripting.Dictionary object to act like an in memmopry database. I load key pair into it via a text file. It works fine. Then I added some functionaility to remove a key. It works like this.

  1. Test for key using DictObj.exists
  2. Remove said key using DictObj.remove
  3. Kill text file using Kill (path) (ekk!)
  4. Make new text file
  5. Save data from DictObj to the new text file.

This part worked like a dream. But! wait, these keys don’t  want to die.

Someplace esle i have a button that saves/updates the key in the dictObject to the text file.

When I called this (and it uses the same sub to write to the text file!!!) the key that i had removed would be writted  to the text time – at the bottom of the list. Amazing.

I used all my debugging foo, and tracked the DictObj through all code paths. What was amazing was that the DictObj was upated (confirmed via watch window), when I saved it to a text file from the delete code it would behave as expected. But when that same sub was called from the save button, as it looped through the DictObj to write the text file, it would magically add the keys that had been removed!!!

What was even more amazing was that I could close down VBA IDE, AND (in this case) PowerPoint, reopen, then click the save button and it would still have the old, removed keys in it!

I looked all over the web but could not find anything pointing out what the issue was. Maybe it just the particularly way I’m using the DictObj, in the end I used .removeall and them relaoded it from the text file in the delete sub. A work around of sorts, but, bloody hell, what an odd bug!!!

Happy to say as of now, all seems to be working as expected, but I’m not counting my chickens!

Bloodly VBA!

#MySpace. How I setup to work. Part 2

With the benefits of the wide screen set out, lets talk about how I’m using it to its fullest potential.

I’m still in the process of working out the exact set up that I like best, but I’ve been playing around. The truth is that the best option depends on what I’m doing. If I’m doing something where there is minimal interaction with the application, they I am loving the set up below. Basically, maximise the IDE, and open up everything you could ever want. It’s great!!!

VBA IDE on Ultra Wide Screen.png

Sometimes, I’m working on something that requires interactions with the OS/File System, or host App, etc, in this case, I use a setup like the one I have mocked up below.

VBA IDE on Ultra Wide Screen With SplitScreenREV.png

As you can see in the above screenshot, the screens are spaced out in a sort of grid, and for this I use WinSplit Revolution (11.04). I spent some time setting up a few “templates” for possible windows configurations. I have not got it quite right, but I’m understanding the “workflow” around the screen a bit more, and have a few more ideas to try. Of course, each person will probably have a  different ideal layout.

BTW, I looked at at least 10, maybe more, screen layout utilities and I can honestly say that WinSplitRevolution is hands down the best – not to complex, not to limited. There are loads and loads out there, but if you want to save yourself the time and effort go for WinSplit. Its a bit of a pain to set the layouts up (i.e. defining the windows size and postion) but once thats done it the best to use by far.

#MySpace. How I setup to work. Part 1

#MySpace, get it! When I was at Dicks a few weeks ago, he was talking about his standing desk and two screen set-up. I think like most devs, how I have my systems and environment set-up to work in is really important to me.

I have been thinking about what the best screen set-up is for a while now, at least the last 3 years, and for a number of factors I ended up with 1 34″ ultra-widescreen. Dicks post made me go out and buy. But getting some money from a lodger funded it!

img_20170223_201829

It’s a DELL U3415W, and cost about £620 delivered. Quite an investment in a screen, but I reason that screens last a very long time, and bring a lot of the party. I’ve only had this for a short while, but so far its excellent, I find it much better than the 2 screen config I have at work. Frankly at this point the thought of working on one 24″ screen makes me feel bad. Here’s the work set-up. Still nice, but not as nice!

img_20170223_130406

So, what are the main difference. Apart from resolution, the DELL is much higher, which is nice, the main thing I love about the ultrawide in the centring issue. With the 2 screens, I have to have one “main” screen, and one off at the side, you can see this in the picture.  Maybe a 3 screen set up would avoid this and be even better, the physically distinct spaces of the two screens is probably better than just the one, but I can’t run 3 screens (without heart ache), from my laptop, plus space, power etc, so that’s that really!

Over all, the new screen is working great. I will add more parts to the series over time, keyboard, mouse, note pads, pens, desks, chairs,… walls, yes I said walls… all good stuff to waste time thinking about!

Welcome to my new blog!

Hi,

You may remember me from such blogs as methodsinexcel.co.uk, or, well that’s it actually. Anyway that site closed down a few years back, due to kids and work etc., and a general reduction in interest in Excel VBA.

Well, the time has come again for the world to ignore my views, so here they will be! Albeit on a WordPress site! It will be more wide in the scope this time, i.e. not just Excel/VBA/Programing… so we will see how it goes.

Hope some of this stuff is useful!

MIE_TheGoodOldDays.png
The Good Old Days