Open word document using CreateObject method of Internet Explorer.
This article is about to open a document using Navigate method of Internet Explorer. We are using CreateObject method for creating navigate method. This method creates an automation object of the specified class. If the application is already running, CreateObject will create a new instance, then uses the Navigate method to open a web page or file.
For implementation of this firstly we have to create word document and save it. Then we need to insert button for calling function in MS Access Forms shown in Fig 1.1.
Then we have to write code for creating instance of internet explorer. After coding part we have to click on button, automatically the control will open the internet explorer and download the file from location as shown in Fig 1.2.
Now we can open this download file as shown in Fig 1.3.
VBA CODE :
Option Compare Database Function OPENINTERNET(ByVal LINK As String) As Boolean Dim INSBROWSER As Object Set INSBROWSER = CreateObject ("InternetExplorer.application") INSBROWSER.Visible = True INSBROWSER.Navigate LINK Exit Function End Function 'code for call the function Private Sub Command0_Click() OPENINTERNET ("http://www.erpmakers.com/MS Access VBA Articles.php") OPENINTERNET ("Path for text file\FileName.docx") End Sub
It is advised that the information provided in the article should not be used for any kind formal or production programming purposes as content of the article may not be complete or well tested. ERP Makers will not be responsible for any kind of damage (monetary, time, personal or any other type) which may take place because of the usage of the content in the article.