Well. I’ma crow a little bit today.
Yesterday, I was ridin’ high coming into the day. I’ve been blowing away the tasks assigned to me. Sure, it takes me months to solve the riddles sometimes. Sure, I do some mumbles and humbles and get beet-red when I have to say “I don’t know how” in staff meetings with my boss and associates. But every macro I’ve had to tackle I’ve knocked out of the park.
Even when I thought I didn’t.
So late last week, the ATR coordinator asked me to look at a problem she’s had with one of the screens she uses. I told you about this – it printed the serial numbers over and over, remember that? Well, I hit that one out of the park too.
Then I came back today and decided I’d have another run at getting the email attachment problem solved. You might not remember this one. Back in the summer we decided it might be a nice feature to be able to attach files to our outgoing email messages to divisions and customers. Sounds easy, right?
Yeah, not so much, it turns out.
Well, for the last – what? six, seven months? more? – I’ve been banging my head against that particular wall. This even came into play before Appmageddon. But I couldn’t do anything with it. I just…couldn’t get it to work.
Yesterday, I opened up that page again and took another look. I saw something I didn’t notice before. Well…that’s not exactly right. I guess I just didn’t see it this way before.
I tweaked. I tested. I tweaked again. Tested again. And you know what?
Shut the front door – I got the email. AND the attachment!
VICTORY! VICTORY FOR ZIIIIIIIMMM! Praise the Lord Most High, for clearly this came from His inspiration. Know how I know that?
Because I have no idea what’s different now that it works when it didn’t before. NONE.
There were a couple of routines I saw, and I recognized a bit of what they might be doing. I changed the references a touch, thinking, “Well, maybe it should be this instead of that.” And voila! Success. Sweet, gratifying success.
OH, I danced! I danced like Snoopy dances, and at my weight, that’s quite the spectacle.
I ran to my boss and bragged, “Hey, I beat your man GW again! I got the email attachment thing to work! I did it!”
I chatted and beamed a moment, and then went back to my desk. I deployed the solution to the production web server. Then, I had a meeting to go to with my boss and his staff members. During that meeting, the ATR Coordinator had to leave for the “Kaizen Event” I mentioned to you before. The meeting broke maybe an hour later, and when I got back to my desk, guess what?
I had an email from the ATR Coordinator.
She said, “We have issues with the intranet. I can’t send any notifications to the divisions. It’s giving an ‘Empty Path’ error now.”
My sphincter tightened so fast and so severely I gained an inch in height. You couldn’t have driven a toothpick in it with a ten-pound sledge.
Okay, I thought, stay calm. The error indicates the message can’t be sent without an attachment now. So…so…what’s that mean?!
OHGODWHATDOESTHATMEANFORTHELOVEOFCHRISTHELPME!!!
Or, you know, something like that.
So, this was like, two o’clock. I putzed around with other solutions but they weren’t going well. Finally, it hit me like a ton of bricks.
Before, we could send messages but not attachments. Now we can send attachments but not messages without them. Solution – put both scripts on the page and have them execute at different times.
Okay, how do I do that?
The way I did it was simple, and a little stupid, but then, so is this entire way of working with this crap, in my view. I simply put two buttons on the page. The first one calls the original script, and sends the message without attachments. The second one uses a modified script, takes the object in the file box (which I added), and embeds it as an object. (No, I didn’t come up with that code; neither did my predecessor though. He borrowed it from the Internet, so we BOTH stand on the shoulders of geniuses to do what we do. So there.)
Then the script sends the message through the local email client running on the machine being used.
Done!
And tested. And tested. And tested. It sends through the Internet, sends through the intranet, and sends the attachments faithfully.
Score!
Appmageddon just got a little less scary.
Now, back to the NAFTA database macro. I have to automate it. And I did; problem is, the automation through the database itself is ssssslllllllllooooooowwwwww. So I did it through an Excel spreadsheet instead, but now have to figure out how to get the two together. Two-step process, maybe? I’ll see.
But the process took something like half an hour through the database. The exact same code, copied and pasted to the workbook’s code editor directly from the database’s editor, runs in eight seconds from the workbook.
Uh…this is a no-brainer.
So, I’ll see what happens there later. For today, I have month-end reporting to do, weekly reporting to do, and I’m still way behind on some of these things.
See ya next time.
-jdt-