I started my other blog (www.benmoorhouse.blogspot.com) a while back, but didn't really know what was going to be put in it, or even the type of content I was going to include!
This is a kick start for me. I'm going to duplicate content though as an experiment on domain names.
This blog will cover the odd random ME update, but mainly me providing script/a walkthrough about a computer bit which I've either found or used in the past week. I'll provide the script / walkthrough, and then talk you through how it works, with a view to helping you use it on your own site.
If at any point you want something adding/researching/explaining that little bit more, PLEASE feel free to just drop me an email (firstname.lastname@example.org) - I dont bite, and would love to hear from you.
Ok enough of the introduction, lets get onto some code.
Opening an .xls document from a web page in Excel rather than in IE.
This goes in the head
Set ExcelApp = CreateObject("Excel.application")
ExcelApp.Visible = True
strPathDoc = "test.xls"
Set myExcelDoc = ExcelApp.Workbooks.Open(strPathDoc)
Set myExcelDoc = Nothing
Set ExcelApp = Nothing
This goes in the body where you want the user to click
< href="#" title="test xls file" style="text-decoration:none" onclick="openExcel()">
Ok now some of you may be thinking "Why on earth would I want to do that?", but you would be suprised at how many times people ask me either because they think it looks rubbish, or they want to really mess around with the excel environment, and it breaks when it loads in IE.
How it works
This is a nice and easy to tweak script.
First it creates an instance of the Excel application called ExcelApp, and makes it visible.
Then so that you dont have one line of code stretching acros 82 lines (!), it puts the path to the file in a variable called strPathDoc.
Then it uses ExcelApp (the newly opened instance of Excel) to open the workbook in the variable.
As the main reason for doing this code is because you want to heavily alter the Excel environment, I assume you will want to launch some code when the file has opened. Which is why the next line runs the subroutine called Auto_Open (which would normally start automatically when the file was opened via the file system).
The next three lines are tidying up - setting the objects to nothing, and ending the function.
nice and easy.
This one is so easy to change to work for you its amazing, simply set your filepath to your excel file on strPathDoc, and change the name of the code you want to run. You could even just comment the last bit out if you didnt need it.
Oh, and for those of you who dont know very much HTML, the link line is broken down into:
< a - the all standard anchor tag
href="#" - the hypertext reference - turns the anchor tag into something clickable without changing the page (you can replace the # with a URL to make the page change too).
title - the title of the link, this will come up when you hover over the link as a tool tip.
Style - you can add style information in here, I removed the text decoration so that the link wasn't underlined. This isn't generally good practice, but was the make or break for my intranet page.
onClick - the all important bit of code which calls the function which was described above.
Anyway, my wife has just got up so it's time to raise the troops and get them ready for off.
All the best,