|
Access denied error when resizing a HTA |
|
|
|
|
Written by Winfred DeKreij
|
|
When I resized a HTA with the following code: Sub Window_onLoad window.resizeTo 500,200 End Sub I came across the following error: Access Denied Code: 0 Do you want to continue running scripts on this page? This was due to a timing issue when loading the file. The Window_onLoad tries to change a property of the HTA, while the HTA is not completely loaded yet. You can solve this problem by adding a short timeout like this: Sub Window_onLoad Window.SetTimeout "Window.ResizeTo 500, 200", 500 End Sub The last "500" here is the time it waits before executing the code. Image of the error message:
|
http://technet.microsoft.com
KB904947
MS recomend use IHTMLWindow2, but I dont know how it use in HTA