This week I was coding a Macro in an Excel file that would open a certain Word file. I used the following code to open Word from Excel:
Set wrd = CreateObject("Word.Application")
wrd.Visible = False
Set doc = wrd.Documents.Open(fileName)
When I opened the Excel file by double clicking it in the Windows Explorer and ran the macro, it gave me an error 'Access denied - 70'. It turns out that on Vista, even if you think you are an administrator, you do not always have administrative rights.
To open the Excel file as an administrator, I had to do the following:
- Open the Windows Explorer.
- Right-mouse click on the Excel file and choose "Create Shortcut".
- Right-mouse click on the shortcut and choose "Properties".
- Click on the tab "Shortcut".
- In the "Target" field, add the path to your Excel program before the filename. Leave a space between the path and the filename. In my case, the path to Excel is "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE".
- Click the "Advanced" button.
- Click "Run as administrator".
- Click "OK" to close the small window and "OK" again to close the properties window.
Now, when you double click the shortcut, you open the Excel file as an administrator and the macro that opens Word runs just fine.
Saturday, January 26, 2008
Opening an Excel file as Administrator on Vista
Posted by Sandra Both at 5:22 PM 0 comments
Thursday, January 3, 2008
Check the date a webpage was last changed
When you browse the web, you sometimes want to know when the page you are viewing was last updated. While viewing the page in your browser, type the following in the address bar of your browser and hit Enter:
javascript:alert(document.lastModified);
It gives you a popup with the date the page was last updated.
Note:
It only works for static HTML pages, since dynamically created pages are created on the fly, that is, today.
Posted by Sandra Both at 3:32 PM 0 comments
Labels: JavaScript