Learning is not attained by chance, it must
be sought for with ardor and diligence.
-Abigail Adams
 
Home   News   Courses   Tips   Templates   Forums   Help   Order   Contact   Logon  
 
NEW: Excel Expert 11 - Learn XLOOKUP    dismiss
Tips & Tricks

New Tips Added Weekly!
Click here to get on our Mailing List

   
 
HTA

Expert - Level 2

Useful Elements

Useful Elements

Autorun
	Sub Window_Onload
		Msgbox "The application has started."
	End Sub
	
Refresh
	Sub RunScript_Refresh
		Location.Reload(True)
	End Sub
	
Change the Cursor
	Sub RunScript_Cursor
		document.body.style.cursor = "wait"
	End Sub
	
Copy To Clipboard
	Sub RunScript_Copy
		strCopy = BasicTextArea.Value
		document.parentwindow.clipboardData.SetData "text", strCopy
	End Sub
	
Paste From Clipboard
	Sub RunScript_Paste
		DataArea.InnerHTML = document.parentwindow.clipboardData.GetData("text")
	End Sub
	
Disable
	Sub RunScript_Disable
		CONTROLID.Disabled = False
	End Sub
	
Confirmation Box
	Sub RunScript_Confirmation
		blnAnswer = window.confirm("Are you sure you want to continue?")
		If blnAnswer Then
			Msgbox "You clicked the OK button"
		Else
			Msgbox "You clicked the Cancel button."
		End If
	End Sub
	
Prompt
	Sub RunScript_Prompt
		strAnswer = window.prompt("Please enter the domain name.", "599CD.com")
		If IsNull(strAnswer) Then
			Msgbox "You clicked the Cancel button"
		Else
			Msgbox "You entered: " & strAnswer
		End If
	End Sub
	
Display Data in a different window
	Sub RunScript_IE
		Set objIE = CreateObject("InternetExplorer.Application")
		objIE.Navigate("about:blank")
		objIE.ToolBar = 0
		objIE.StatusBar = 0
		Set objDoc = objIE.Document.Body
		strHTML = "<B>This information is displayed in a separate window.</B>"
		objDoc.InnerHTML = strHTML
		objIE.Visible = True
	End Sub
	
Print
	Sub RunScript_Print
		Window.Print()
	End Sub
	
Save to .htm
	Sub RunScript_Save
		Set objFSO = CreateObject("Scripting.FileSystemObject")
		objFSO.CreateTextFile("test.htm")
		Set objFile = objFSO.OpenTextFile("test.htm", 2)
		objFile.WriteLine DataArea.InnerHTML
		objFile.Close
	End Sub
	
Timer
	Sub Window_OnLoad
		iTimerID = window.setInterval("RunScript", 5000, "VBScript")
	End Sub
	
Tooltip
	Sub RunScript_Tooltip
		Tooltip.Title = "You successfully changed the tooltip."
	End Sub
	
Quit
	Sub RunScript_Quit
		Window.Close
	End Sub
	

You can use these in combination to produce some dynamic results.


Sample Files
Various.hta


Previous Lesson: Expert Level 1 | Next Lesson: Expert Level 3

 

Alex Hedley (Avatar) By: Alex Hedley


Click here to sign up for more FREE tips

 

 

Learn
 
Accessindex
Excelindex
Wordindex
Windowsindex
PowerPointindex
Photoshopindex
Visual Basicindex
ASPindex
Seminars
More...
Customers
 
Account Login
Online Theater
Downloads
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Articles
Search The Site
Waiting List
Production Schedule
Collapse Menus
Help
 
Live Chat
Customer Support
WalkThru Tutorials
Troubleshooting
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Order
 
Video Tutorials
Handbooks
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Gift CDs
Contact
 
Live Chat
General Info
Support Policy
Contact Form
Email Richard
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

YouTube Channel    LinkedIn

Blog RSS Feed