<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-15508355</id><updated>2012-02-16T18:51:05.657-08:00</updated><title type='text'>Sapass</title><subtitle type='html'>List of things what I know in programming. The areas to be covered are...
VBA, ADO, SAP, RFC, Idoc, ALE etc...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>85</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-15508355.post-7712059088351983856</id><published>2010-11-29T04:25:00.000-08:00</published><updated>2010-11-29T04:29:39.403-08:00</updated><title type='text'>Pukiwiki Page name conversion in Excel VBA</title><content type='html'>This is to convert PukiWiki filename into converted text.&lt;br /&gt;From: 536974654E6176696761746F72.txt   &lt;br /&gt;﻿To: SiteNavigator&lt;br /&gt;-----&lt;br /&gt;Function GetWikiName(strFileName As String, Optional strFr As String = "EUC-JP", Optional strTo As String = "Unicode") As String&lt;br /&gt;&lt;br /&gt;Dim lngLen As Long&lt;br /&gt;Dim lngIdx As Long&lt;br /&gt;Dim strTranslated As String&lt;br /&gt;Dim strTemp() As Byte&lt;br /&gt;&lt;br /&gt;strTranslated = ""&lt;br /&gt;lngLen = (Len(strFileName) - 4) / 2 - 1&lt;br /&gt;&lt;br /&gt;ReDim strTemp(lngLen)&lt;br /&gt;For lngIdx = 0 To lngLen&lt;br /&gt;    strTemp(lngIdx) = "&amp;amp;H" &amp;amp; Mid(strFileName, lngIdx * 2 + 1, 2)&lt;br /&gt;    DoEvents&lt;br /&gt;Next&lt;br /&gt;&lt;br /&gt;GetWikiName = Euc2Jis(strTemp, strFr, strTo)&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;Function Euc2Jis(ByRef src() As Byte, Optional strFrom = "EUC-JP", Optional strTo = "Unicode") As Byte()&lt;br /&gt;Dim EUC As Object&lt;br /&gt;Dim JIS As Object&lt;br /&gt;&lt;br /&gt;Const adTypeBinary = 1&lt;br /&gt;Const adTypeText = 2&lt;br /&gt;Const adReadAll = -1&lt;br /&gt;Const adCR = 13&lt;br /&gt;Const adCRLF = -1&lt;br /&gt;Const adLF = 10&lt;br /&gt;&lt;br /&gt;Set EUC = CreateObject("ADODB.Stream")&lt;br /&gt;Set JIS = CreateObject("ADODB.Stream")&lt;br /&gt;&lt;br /&gt;EUC.Open&lt;br /&gt;EUC.Type = adTypeBinary&lt;br /&gt;EUC.Write src&lt;br /&gt;EUC.Position = 0&lt;br /&gt;EUC.Type = adTypeText&lt;br /&gt;EUC.Charset = strFrom&lt;br /&gt;&lt;br /&gt;JIS.Open&lt;br /&gt;JIS.Type = adTypeText&lt;br /&gt;JIS.Charset = strTo&lt;br /&gt;JIS.LineSeparator = adCRLF&lt;br /&gt;&lt;br /&gt;EUC.CopyTo JIS, adReadAll&lt;br /&gt;EUC.Close&lt;br /&gt;Set EUC = Nothing&lt;br /&gt;&lt;br /&gt;JIS.Position = 0&lt;br /&gt;JIS.Type = adTypeBinary&lt;br /&gt;&lt;br /&gt;Euc2Jis = JIS.Read(adReadAll)&lt;br /&gt;&lt;br /&gt;JIS.Close&lt;br /&gt;Set JIS = Nothing&lt;br /&gt;&lt;br /&gt;End Function&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-7712059088351983856?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/7712059088351983856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=7712059088351983856' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/7712059088351983856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/7712059088351983856'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2010/11/pukiwiki-page-name-conversion-in-excel.html' title='Pukiwiki Page name conversion in Excel VBA'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113677685508986937</id><published>2006-01-08T19:17:00.000-08:00</published><updated>2006-01-08T19:20:55.113-08:00</updated><title type='text'>FTP - Mass processing to put files</title><content type='html'>This snippet can be used for putting mass files on remote server via FTP. You specify Server name, User ID, Password, Remote directory, Local directory and files then the function will put files on the remote server. For declaration of the APIs, refer to the previous posts.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Public Function PutFiles(FtpSvr As String, UserID As String, _&lt;br /&gt;Password As String, RemoteDirectory As String, _&lt;br /&gt;LocalDirectory As String, LocalFiles As Collection) As Long&lt;br /&gt;Dim iHandle As Long&lt;br /&gt;Dim iFTP As Long&lt;br /&gt;Dim lngRet As Long&lt;br /&gt;Dim ErrText As String&lt;br /&gt;Dim varUnit As Variant&lt;br /&gt;PutFiles = vbOK&lt;br /&gt;'Connection open&lt;br /&gt;iHandle = InternetOpen(vbNullString, _&lt;br /&gt;INTERNET_OPEN_TYPE_PRECONFIG, _&lt;br /&gt;vbNullString, _&lt;br /&gt;vbNullString, _&lt;br /&gt;0&amp;)&lt;br /&gt;If iHandle = 0 Then PutFiles = vbCancel: GoTo GOEXIT ': Exit Function 'Error&lt;br /&gt;'Connect to server&lt;br /&gt;iFTP = InternetConnect(iHandle, _&lt;br /&gt;FtpSvr, _&lt;br /&gt;INTERNET_DEFAULT_FTP_PORT, _&lt;br /&gt;UserID, _&lt;br /&gt;Password, _&lt;br /&gt;INTERNET_SERVICE_FTP, _&lt;br /&gt;0&amp;, _&lt;br /&gt;0&amp;)&lt;br /&gt;If iFTP = 0 Then PutFiles = vbCancel: GoTo GOEXIT&lt;br /&gt;&lt;br /&gt;'Put file to server. Can switch Ascii/Binary by changing the parameter below.&lt;br /&gt;'Change directory on Local&lt;br /&gt;ChDir LocalDirectory&lt;br /&gt;'Change directory on Remote&lt;br /&gt;lngRet = FtpSetCurrentDirectory(iFTP, RemoteDirectory)&lt;br /&gt;If lngRet = 0 Then PutFiles = vbCancel ': Exit Function 'Error&lt;br /&gt;'&lt;br /&gt;For Each varUnit In LocalFiles&lt;br /&gt;   lngRet = FtpPutFile(iFTP, _&lt;br /&gt;   varUnit &amp; vbNullChar, _&lt;br /&gt;   varUnit &amp; vbNullChar, _&lt;br /&gt;   FTP_TRANSFER_TYPE_ASCII, _&lt;br /&gt;   0&amp;)&lt;br /&gt;   DoEvents&lt;br /&gt;Next&lt;br /&gt;&lt;br /&gt;GOEXIT:&lt;br /&gt;lngRet = InternetCloseHandle(iFTP)&lt;br /&gt;lngRet = InternetCloseHandle(iHandle)&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113677685508986937?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113677685508986937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113677685508986937' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113677685508986937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113677685508986937'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2006/01/ftp-mass-processing-to-put-files.html' title='FTP - Mass processing to put files'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113663583865164594</id><published>2006-01-07T04:03:00.000-08:00</published><updated>2006-01-07T04:10:38.680-08:00</updated><title type='text'>FTP - List up files on remote server</title><content type='html'>Here is a code to create a list of the files on the remote server. The function ListUpFiles will create a collection of the file name that you have specified as a parameter. In addition to the FTPFindFirstFile and InternetFindNextFile, you will need the declaration of the functions like Open/Close. (Refer to the past posts for these functions.)&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Get first file&lt;br /&gt;Public Declare Function FtpFindFirstFile Lib "wininet.dll" _&lt;br /&gt;Alias "FtpFindFirstFileA" (ByVal hFtpSession As Long, _&lt;br /&gt;ByVal lpszSearchFile As String, ByRef lpFindFileData As WIN32_FIND_DATA, _&lt;br /&gt;ByVal dwFlags As Long, ByVal dwContent As Long) As Long&lt;br /&gt;&lt;br /&gt;'Get next file&lt;br /&gt;Public Declare Function InternetFindNextFile Lib "wininet.dll" _&lt;br /&gt;Alias "InternetFindNextFileA" _&lt;br /&gt;(ByVal hFind As Long, ByRef findFileData As WIN32_FIND_DATA) _&lt;br /&gt;As Boolean&lt;br /&gt;   &lt;br /&gt;Public Type FILETIME&lt;br /&gt;   dwLowDateTime As Long&lt;br /&gt;   dwHighDateTime As Long&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Public Type WIN32_FIND_DATA&lt;br /&gt;   dwFileAttributes As Long&lt;br /&gt;   ftCreationTime As FILETIME&lt;br /&gt;   ftLastAccessTime As FILETIME&lt;br /&gt;   ftLastWriteTime As FILETIME&lt;br /&gt;   nFileSizeHigh As Long&lt;br /&gt;   nFileSizeLow As Long&lt;br /&gt;   dwReserved0 As Long&lt;br /&gt;   dwReserved1 As Long&lt;br /&gt;   cFileName As String * 260&lt;br /&gt;   cAlternate As String * 14&lt;br /&gt;End Type&lt;br /&gt;...&lt;br /&gt;Public Function ListUpFiles(FtpSvr As String, UserID As String, _&lt;br /&gt;Password As String, RemoteDirectory As String) As Collection&lt;br /&gt;&lt;br /&gt;Dim iHandle As Long&lt;br /&gt;Dim iFTP As Long&lt;br /&gt;Dim lngRet As Long&lt;br /&gt;Dim ErrText As String&lt;br /&gt;Dim varUnit As Variant&lt;br /&gt;Dim w32File As WIN32_FIND_DATA&lt;br /&gt;Dim strFile As String&lt;br /&gt;&lt;br /&gt;Set ListUpFiles = New Collection&lt;br /&gt; &lt;br /&gt;'Connection open&lt;br /&gt;iHandle = InternetOpen(vbNullString, _&lt;br /&gt;INTERNET_OPEN_TYPE_PRECONFIG, _&lt;br /&gt;vbNullString, _&lt;br /&gt;vbNullString, _&lt;br /&gt;0&amp;)&lt;br /&gt;If iHandle = 0 Then GoTo GOEXIT:  ' Exit Function 'Error&lt;br /&gt;&lt;br /&gt;'Connect to server&lt;br /&gt;iFTP = InternetConnect(iHandle, _&lt;br /&gt;FtpSvr, _&lt;br /&gt;INTERNET_DEFAULT_FTP_PORT, _&lt;br /&gt;UserID, _&lt;br /&gt;Password, _&lt;br /&gt;INTERNET_SERVICE_FTP, _&lt;br /&gt;0&amp;, _&lt;br /&gt;0&amp;)&lt;br /&gt;If iFTP = 0 Then GoTo GOEXIT&lt;br /&gt;&lt;br /&gt;'Change directory on Remote&lt;br /&gt;lngRet = FtpSetCurrentDirectory(iFTP, RemoteDirectory)&lt;br /&gt;If lngRet = 0 Then GoTo GOEXIT ': Exit Function 'Error&lt;br /&gt;&lt;br /&gt;'&lt;br /&gt;lngRet = FtpFindFirstFile(iFTP, RemoteDirectory, _&lt;br /&gt;                          w32File, 0, 0)&lt;br /&gt;Do&lt;br /&gt;   If lngRet &gt; 0 Then&lt;br /&gt;      strFile = Left(w32File.cFileName, _&lt;br /&gt;                InStr(w32File.cFileName, Chr(0)) - 1)&lt;br /&gt;      ListUpFiles.Add strFile&lt;br /&gt;   End If&lt;br /&gt;   DoEvents&lt;br /&gt;Loop While InternetFindNextFile(lngRet, w32File) &lt;&gt; 0&lt;br /&gt;&lt;br /&gt;GOEXIT:&lt;br /&gt;lngRet = InternetCloseHandle(iFTP)&lt;br /&gt;lngRet = InternetCloseHandle(iHandle)&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;You can use this with the code below.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim colTemp As Collection&lt;br /&gt;Dim varUnit As Variant&lt;br /&gt;Set colTemp = ListUpFiles("blue.client.jp", _&lt;br /&gt;    "UserID", "PassWord", "/")&lt;br /&gt;For Each varUnit In colTemp&lt;br /&gt;  Debug.Print varUnit&lt;br /&gt;Next&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113663583865164594?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113663583865164594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113663583865164594' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113663583865164594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113663583865164594'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2006/01/ftp-list-up-files-on-remote-server.html' title='FTP - List up files on remote server'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113655366379214709</id><published>2006-01-06T05:20:00.000-08:00</published><updated>2006-01-06T05:21:03.813-08:00</updated><title type='text'>Windows - Check window is maxmized</title><content type='html'>On the contrary to IsIconic API, you can check if the window is maxmized by IsZoomed API.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Declare API&lt;br /&gt;Public Declare Function IsZoomed Lib "USER32" _&lt;br /&gt;(ByVal hWnd As Long) As Long&lt;br /&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim lngReturn As Long&lt;br /&gt;lngReturn = IsZoomed(Application.hWnd)&lt;br /&gt;If lngReturn &lt;&gt; 0 Then&lt;br /&gt;   MsgBox "Window is maximized"&lt;br /&gt;Else&lt;br /&gt;   MsgBox "Window is not maximized"&lt;br /&gt;End If&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113655366379214709?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113655366379214709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113655366379214709' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113655366379214709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113655366379214709'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2006/01/windows-check-window-is-maxmized.html' title='Windows - Check window is maxmized'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113647394659786489</id><published>2006-01-05T07:09:00.000-08:00</published><updated>2006-01-05T07:12:26.663-08:00</updated><title type='text'>Windows - Check window is minimized</title><content type='html'>This API - IsIconic - is for checking the window status. If it is minimized and iconized, the result is returned as 1. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Decare API&lt;br /&gt;Public Declare Function IsIconic Lib "USER32" _&lt;br /&gt;  (ByVal hWnd As Long) As Long&lt;br /&gt;&lt;br /&gt;Private Sub Temp()&lt;br /&gt;Dim lngResult As Long&lt;br /&gt;lngResult = IsIconic(Application.hWnd)&lt;br /&gt;If lngResult = 1 Then&lt;br /&gt;   MsgBox Application.Name &amp; " is minimized"&lt;br /&gt;Else&lt;br /&gt;   MsgBox Application.Name &amp; " is not minimized"&lt;br /&gt;End If&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113647394659786489?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113647394659786489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113647394659786489' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113647394659786489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113647394659786489'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2006/01/windows-check-window-is-minimized.html' title='Windows - Check window is minimized'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113638629996172275</id><published>2006-01-04T06:49:00.000-08:00</published><updated>2006-01-04T06:51:39.986-08:00</updated><title type='text'>Windows - Display About dialog</title><content type='html'>By declaring ShellAbout function, we can display "About" dialog in application. Here is an example of the code.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Public Declare Function ShellAbout Lib "SHELL32" _&lt;br /&gt;  Alias "ShellAboutA" _&lt;br /&gt;  (ByVal hWnd As Long, ByVal szApp As String, _&lt;br /&gt;   ByVal szOtherStuff As String, ByVal hIcon As Long) As Long&lt;br /&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim lngRet As Long&lt;br /&gt;lngRet = ShellAbout(Application.hWnd, "Sapass", vbCrLf &amp; "Description", 0)&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113638629996172275?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113638629996172275/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113638629996172275' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113638629996172275'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113638629996172275'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2006/01/windows-display-about-dialog.html' title='Windows - Display About dialog'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113370569244028537</id><published>2005-12-04T06:13:00.000-08:00</published><updated>2005-12-04T06:14:52.453-08:00</updated><title type='text'>Windows - Sleep</title><content type='html'>Sleep function makes the running process sleep for specified milli seconds. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)&lt;br /&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;MsgBox "Fall into sleep.."&lt;br /&gt;Sleep 5000&lt;br /&gt;MsgBox "Slept 5000 mm sec"&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113370569244028537?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113370569244028537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113370569244028537' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113370569244028537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113370569244028537'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/12/windows-sleep.html' title='Windows - Sleep'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113360121348993281</id><published>2005-12-03T16:48:00.000-08:00</published><updated>2005-12-03T16:49:55.996-08:00</updated><title type='text'>FTP - Rename file by Wininet API</title><content type='html'>In Wininet, in order to rename the file name on FTP server, this FtpRenameFile API needs to be called. &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Rename File&lt;br /&gt;Private Declare Function FtpRenameFile Lib "wininet.dll" _&lt;br /&gt;Alias "FtpRenameFileA" _&lt;br /&gt;(ByVal hFtpSession As Long, ByVal lpszExisting As String, _&lt;br /&gt;ByVal lpszNew As String) As Boolean&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113360121348993281?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113360121348993281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113360121348993281' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113360121348993281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113360121348993281'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/12/ftp-rename-file-by-wininet-api.html' title='FTP - Rename file by Wininet API'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113360117064241011</id><published>2005-12-03T07:04:00.000-08:00</published><updated>2005-12-03T07:07:02.790-08:00</updated><title type='text'>FTP - Delete file by Wininet API</title><content type='html'>This is for deleting file through FTP by wininet.dll API. After get connected through the Internet connection function, this can be used. For the connection, refer to the past post.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Delete File&lt;br /&gt;Private Declare Function FtpDeleteFile Lib "wininet.dll" _ &lt;br /&gt;Alias "FtpDeleteFileA" _&lt;br /&gt;(ByVal hFtpSession As Long, ByVal lpszFileName As String) As Boolean&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113360117064241011?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113360117064241011/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113360117064241011' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113360117064241011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113360117064241011'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/12/ftp-delete-file-by-wininet-api.html' title='FTP - Delete file by Wininet API'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113360112525583173</id><published>2005-12-03T03:55:00.000-08:00</published><updated>2005-12-03T03:57:33.423-08:00</updated><title type='text'>FTP - Remove directory by Wininet API</title><content type='html'>Removing directory can be done through this function in wininet.dll.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Remove Direcotry&lt;br /&gt;Private Declare Function FtpRemoveDirectory Lib "wininet.dll" _ &lt;br /&gt;Alias "FtpRemoveDirectoryA" _&lt;br /&gt;(ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113360112525583173?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113360112525583173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113360112525583173' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113360112525583173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113360112525583173'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/12/ftp-remove-directory-by-wininet-api.html' title='FTP - Remove directory by Wininet API'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113360107803685562</id><published>2005-12-03T03:54:00.000-08:00</published><updated>2005-12-03T03:57:50.930-08:00</updated><title type='text'>FTP - Create directory by Wininet API</title><content type='html'>This is for creating directory on FTP server through Ftp CreateDirectory of wininet.dll.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Create Directory&lt;br /&gt;Private Declare Function FtpCreateDirectory Lib "wininet.dll" _&lt;br /&gt;Alias "FtpCreateDirectoryA" _&lt;br /&gt;(ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113360107803685562?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113360107803685562/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113360107803685562' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113360107803685562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113360107803685562'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/12/ftp-create-directory-by-wininet-api.html' title='FTP - Create directory by Wininet API'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113360048549596758</id><published>2005-12-03T00:59:00.000-08:00</published><updated>2006-01-06T17:50:30.246-08:00</updated><title type='text'>FTP - Change directory by Wininet API</title><content type='html'>Changing the directory in FTP can be done with the code below. Same as GetCurDirectory, this can be used in conjunction with connect/disconnect. Refer to the past post for these functions.&lt;br /&gt;This can be used as function in Excel like:&lt;br /&gt;=SetCurrentDir("sapass.metro.client.jp","username","password","TargetDir")&lt;br /&gt;Returns true if it can be changed successfully.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Set current directory&lt;br /&gt;Private Declare Function FtpSetCurrentDirectory Lib "wininet.dll" _&lt;br /&gt;Alias "FtpSetCurrentDirectoryA" _&lt;br /&gt;(ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;Function SetCurrentDir(strFtpSvr As String, strUserID As String, _&lt;br /&gt;strPassword As String, strTargetDir As String) As Boolean&lt;br /&gt;Dim hInternet As Long&lt;br /&gt;Dim hFTP As Long&lt;br /&gt;Dim lngRet As Long&lt;br /&gt;&lt;br /&gt;SetCurrentDir = False&lt;br /&gt;'Open connection&lt;br /&gt;hInternet = InternetOpen(vbNullString, _&lt;br /&gt;INTERNET_OPEN_TYPE_PRECONFIG, _&lt;br /&gt;vbNullString, _&lt;br /&gt;vbNullString, _&lt;br /&gt;0&amp;)&lt;br /&gt;If hInternet = 0 Then Exit Function  'Error occurred&lt;br /&gt;'Connect to server&lt;br /&gt;hFTP = InternetConnect(hInternet, _&lt;br /&gt;strFtpSvr, _&lt;br /&gt;INTERNET_DEFAULT_FTP_PORT, _&lt;br /&gt;strUserID, _&lt;br /&gt;strPassword, _&lt;br /&gt;INTERNET_SERVICE_FTP, _&lt;br /&gt;0&amp;, _&lt;br /&gt;0&amp;)&lt;br /&gt;If hFTP = 0 Then Exit Function 'Error occurred&lt;br /&gt;&lt;bold&gt;lngRet = FtpSetCurrentDirectory(hFTP, strTargetDir)&lt;/bold&gt;&lt;br /&gt;If lngRet &lt;&gt; 0 Then SetCurrentDir = True&lt;br /&gt;lngRet = InternetCloseHandle(hFTP)&lt;br /&gt;lngRet = InternetCloseHandle(hInternet)&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113360048549596758?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113360048549596758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113360048549596758' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113360048549596758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113360048549596758'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/12/ftp-change-directory-by-wininet-api.html' title='FTP - Change directory by Wininet API'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113360033301110108</id><published>2005-12-03T00:55:00.000-08:00</published><updated>2005-12-03T02:07:08.120-08:00</updated><title type='text'>FTP - Get current directory with Wininet API</title><content type='html'>The declaration of the FtpGetCurrentlDirecotry in winninet API is like this. With the combination of connect/disconnect this can be used.&lt;br /&gt;You can use this e.g. from Excel sheet like:&lt;br /&gt;=GetCurrentDir("sapass.metro.client.jp","username","password")&lt;br /&gt;&lt;br /&gt;*For connection &amp; discconection, refer to the log.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Get curernt directory&lt;br /&gt;Private Declare Function FtpGetCurrentDirectory Lib "wininet.dll" _&lt;br /&gt;Alias "FtpGetCurrentDirectoryA" _&lt;br /&gt;(ByVal hFtpSession As Long, ByVal lpszCurrentDirectory As String, _&lt;br /&gt; ByRef lpdwCurrentDirectory As Long) As Boolean&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;Function GetCurrentDir(strFtpSvr As String, strUserID As String, _&lt;br /&gt;strPassword As String) As String&lt;br /&gt;Dim hInternet As Long&lt;br /&gt;Dim hFTP As Long&lt;br /&gt;Dim lngRet As Long&lt;br /&gt;Dim strErrText As String&lt;br /&gt;&lt;br /&gt;GetCurrentDir = String(255, 0)&lt;br /&gt;'Open connection&lt;br /&gt;hInternet = InternetOpen(vbNullString, _&lt;br /&gt;INTERNET_OPEN_TYPE_PRECONFIG, _&lt;br /&gt;vbNullString, _&lt;br /&gt;vbNullString, _&lt;br /&gt;0&amp;)&lt;br /&gt;If hInternet = 0 Then GetCurrentDir = "": Exit Function 'Error occurred&lt;br /&gt;'Connect to server&lt;br /&gt;hFTP = InternetConnect(hInternet, _&lt;br /&gt;strFtpSvr, _&lt;br /&gt;INTERNET_DEFAULT_FTP_PORT, _&lt;br /&gt;strUserID, _&lt;br /&gt;strPassword, _&lt;br /&gt;INTERNET_SERVICE_FTP, _&lt;br /&gt;0&amp;, _&lt;br /&gt;0&amp;)&lt;br /&gt;If hFTP = 0 Then GetCurrentDir = "": Exit Function 'Error occurred&lt;br /&gt;lngRet = FtpGetCurrentDirectory(hFTP, GetCurrentDir, Len(GetCurrentDir))&lt;br /&gt;lngRet = InternetCloseHandle(hFTP)&lt;br /&gt;lngRet = InternetCloseHandle(hInternet)&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113360033301110108?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113360033301110108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113360033301110108' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113360033301110108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113360033301110108'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/12/ftp-get-current-directory-with-wininet.html' title='FTP - Get current directory with Wininet API'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113352750777614291</id><published>2005-12-02T04:22:00.000-08:00</published><updated>2005-12-03T01:01:41.923-08:00</updated><title type='text'>Windows - Check if destination is reachable</title><content type='html'>Check if the destination is reacheable or not.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Private Type QOCINFO&lt;br /&gt;  dwSize As Long&lt;br /&gt;  dwFlags As Long&lt;br /&gt;  dwInSpeed As Long&lt;br /&gt;  dwOutSpeed As Long&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Private Declare Function IsDestinationReachable Lib "sensapi.dll" _&lt;br /&gt;   Alias "IsDestinationReachableA" _&lt;br /&gt;  (ByVal lpszDestination As String, _&lt;br /&gt;   lpQOCInfo As QOCINFO) As Long&lt;br /&gt;&lt;br /&gt;Function DestinationFound(strAddress As String) As Boolean&lt;br /&gt;Dim objQoc As QOCINFO&lt;br /&gt;objQoc.dwSize = Len(objQoc)&lt;br /&gt;DestinationFound = IsDestinationReachable(strAddress, objQoc)&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113352750777614291?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113352750777614291/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113352750777614291' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113352750777614291'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113352750777614291'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/12/windows-check-if-destination-is.html' title='Windows - Check if destination is reachable'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113301544094535057</id><published>2005-11-26T06:28:00.000-08:00</published><updated>2005-11-26T06:30:40.956-08:00</updated><title type='text'>Windows - Parse HTML</title><content type='html'>This snippet reads HTML as document and help to recognize tag/class and so on during processing. The logic can be used when you want to transfor the HTML into some other format.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;&lt;br /&gt;Dim objBrowser As Object&lt;br /&gt;Dim objBody As Object&lt;br /&gt;&lt;br /&gt;Set objBrowser = CreateObject("InternetExplorer.Application")&lt;br /&gt;objBrowser.navigate "http://sapass.metro.client.jp"&lt;br /&gt;Do Until objBrowser.busy = False&lt;br /&gt;   DoEvents&lt;br /&gt;Loop&lt;br /&gt;&lt;br /&gt;ParseBody objBody:=objBrowser.document.body&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Sub ParseBody(objBody As Object)&lt;br /&gt;Dim objElement As Object&lt;br /&gt;For Each objElement In objBody.Children&lt;br /&gt;   If objElement.Children.Length &gt; 0 Then&lt;br /&gt;      ParseBody objBody:=objElement&lt;br /&gt;   End If&lt;br /&gt;   Debug.Print objElement.tagname&lt;br /&gt;Next&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113301544094535057?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113301544094535057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113301544094535057' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113301544094535057'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113301544094535057'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/11/windows-parse-html.html' title='Windows - Parse HTML'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113222920480491419</id><published>2005-11-17T04:04:00.000-08:00</published><updated>2005-11-17T04:06:44.816-08:00</updated><title type='text'>Windows - Remove IE cache</title><content type='html'>This snippet helps to remove cached data for IE. If you need to obtain latest data through e.g. XMLHTTP, this may be useful.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Private Declare Function DeleteUrlCacheEntry Lib "wininet" _&lt;br /&gt;Alias "DeleteUrlCacheEntryA" (ByVal lpszUrlName As String) As Long&lt;br /&gt;...&lt;br /&gt;Dim objDocument As MSHTML.HTMLDocument&lt;br /&gt;Const strurl As String = "http://site.com/page.html"&lt;br /&gt;DeleteUrlCacheEntry(strurl)&lt;br /&gt;Set objDocument = objMSHTML.createDocumentFromUrl(strurl, vbNullString)&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113222920480491419?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113222920480491419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113222920480491419' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113222920480491419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113222920480491419'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/11/windows-remove-ie-cache.html' title='Windows - Remove IE cache'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113206731473993387</id><published>2005-11-15T07:06:00.000-08:00</published><updated>2005-11-15T07:08:34.750-08:00</updated><title type='text'>XL - Open URL 3</title><content type='html'>The other alternative to open URL from Excel VBA form. This actually triggers Explorer but subsequently it kicks up Internet Explorer and show the URL in the new window.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Shell "EXPLORER.EXE http://sapass.metro.client.jp/"&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113206731473993387?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113206731473993387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113206731473993387' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113206731473993387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113206731473993387'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/11/xl-open-url-3.html' title='XL - Open URL 3'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113196691247612505</id><published>2005-11-14T03:12:00.000-08:00</published><updated>2005-11-14T03:15:12.490-08:00</updated><title type='text'>XL - Check if Excel runs on Internet Explorer</title><content type='html'>We can see if the Excel is running on IE or not by checking the container of workbook. Here is an example of functino to check it.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Function CheckRunOnIE() As Boolean&lt;br /&gt;On Error Resume Next&lt;br /&gt;CheckRunOnIE = _&lt;br /&gt;IIf(Not(ThisWorkbook.Container.Name Like "*Internet Explorer*"), _&lt;br /&gt;False, True)&lt;br /&gt;On Error GoTo 0&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113196691247612505?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113196691247612505/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113196691247612505' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113196691247612505'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113196691247612505'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/11/xl-check-if-excel-runs-on-internet.html' title='XL - Check if Excel runs on Internet Explorer'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113189343986712748</id><published>2005-11-13T06:46:00.000-08:00</published><updated>2005-11-13T06:50:39.890-08:00</updated><title type='text'>XL - Calendar control</title><content type='html'>To show calendar, you have to use calendar control in userform. Calendar control is provided with the office package as "MSCAL.OCX" (Microsoft Calendar Control). This calendar control has several methods like:&lt;br /&gt;NextDay, NextMonth, PreviousDay, PreviousMonth, Refresh, Today...&lt;br /&gt;Once after the date is selected, the date will be kept in value property of the control. Here is an example:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;VERSION 5.00&lt;br /&gt;Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} UserForm &lt;br /&gt;   Caption         =   "UserForm"&lt;br /&gt;   ClientHeight    =   2475&lt;br /&gt;   ClientLeft      =   45&lt;br /&gt;   ClientTop       =   330&lt;br /&gt;   ClientWidth     =   3225&lt;br /&gt;   OleObjectBlob   =   "UserForm.frx":0000&lt;br /&gt;   StartUpPosition =   1  'CenterOwner&lt;br /&gt;End&lt;br /&gt;Attribute VB_Name = "UserForm"&lt;br /&gt;Attribute VB_GlobalNameSpace = False&lt;br /&gt;Attribute VB_Creatable = False&lt;br /&gt;Attribute VB_PredeclaredId = True&lt;br /&gt;Attribute VB_Exposed = False&lt;br /&gt;Option Explicit&lt;br /&gt;&lt;br /&gt;Dim datCalendar As Date&lt;br /&gt;&lt;br /&gt;Private Sub OkButton_Click()&lt;br /&gt;Hide&lt;br /&gt;datCalendar = Calendar1.Value&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113189343986712748?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113189343986712748/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113189343986712748' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113189343986712748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113189343986712748'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/11/xl-calendar-control.html' title='XL - Calendar control'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113180944031338243</id><published>2005-11-12T07:27:00.000-08:00</published><updated>2005-11-12T07:30:40.340-08:00</updated><title type='text'>XL - Update Excel file without opening</title><content type='html'>This snippet shows how to create Excel content without opening it. After creation of xlBook, if we specify existing file, we can update the contents.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Private Sub Button_Click()&lt;br /&gt;Dim xlBook As Object&lt;br /&gt;'Create Excel object&lt;br /&gt;Set xlBook = CreateObject("Excel.Sheet")&lt;br /&gt;'Put data &lt;br /&gt;xlBook.Sheets(1).Cells(1, 1).Value = "Test"&lt;br /&gt;xlBook.Sheets(1).Cells(1, 2).Value = "Data"&lt;br /&gt;xlBook.Sheets(1).Cells(1, 3).Value = Now()&lt;br /&gt;'Disable overwrite confirmation prompt&lt;br /&gt;xlBook.Application.DisplayAlerts = False&lt;br /&gt;'Save Excel book&lt;br /&gt;xlBook.SaveAs FileName:="C:\temp\temp.xls"&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113180944031338243?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113180944031338243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113180944031338243' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113180944031338243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113180944031338243'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/11/xl-update-excel-file-without-opening.html' title='XL - Update Excel file without opening'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113177137182656900</id><published>2005-11-11T20:55:00.000-08:00</published><updated>2005-11-11T21:26:43.563-08:00</updated><title type='text'>SAPRFC - Reconnect</title><content type='html'>Reconnect to SAP can be done with Reconnect method of Connection object. Here is the example of code.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Reconnect()&lt;br /&gt;&lt;br /&gt;Dim sapConn As Object 'Declare variant&lt;br /&gt;Set sapConn = CreateObject("SAP.Functions") 'Create ActiveX object&lt;br /&gt;&lt;br /&gt;If sapConn.Connection.Logon(0, False) &lt;&gt; True Then 'Try Logon&lt;br /&gt;   sapConn.Connection.LastError&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;sapConn.Connection.Logoff&lt;br /&gt;MsgBox "Logged off then Reconnect"&lt;br /&gt;&lt;strong&gt;sapConn.Connection.Reconnect&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;sapConn.Connection.SystemInformation&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113177137182656900?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113177137182656900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113177137182656900' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113177137182656900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113177137182656900'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/11/saprfc-reconnect.html' title='SAPRFC - Reconnect'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113175947801595279</id><published>2005-11-11T17:36:00.000-08:00</published><updated>2005-11-11T17:37:58.016-08:00</updated><title type='text'>SAPRFC - Logoff from SAP</title><content type='html'>Logon is pretty simple. Just call Logoff method for the connection object.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Dim sapConn As Object 'Declare variant&lt;br /&gt;Set sapConn = CreateObject("SAP.Functions") 'Create ActiveX object&lt;br /&gt;&lt;br /&gt;sapConn.Connection.RfcWithDialog = 1&lt;br /&gt;If sapConn.Connection.Logon(0, False) &lt;&gt; True Then 'Try Logon&lt;br /&gt;   sapConn.Connection.SystemMessages&lt;br /&gt;End If&lt;br /&gt;sapConn.Connection.SystemInformation&lt;br /&gt;&lt;strong&gt;sapConn.Connection.Logoff&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113175947801595279?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113175947801595279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113175947801595279' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113175947801595279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113175947801595279'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/11/saprfc-logoff-from-sap.html' title='SAPRFC - Logoff from SAP'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113175921991433009</id><published>2005-11-10T17:27:00.000-08:00</published><updated>2005-11-11T17:33:51.560-08:00</updated><title type='text'>SAPRFC - Logon to SAP 6 - Show system info</title><content type='html'>System information can be captured with the methods provided by SAP. Logon error message can be done by SystemMessages method of the connection object. For the logon system information is done with SystemInformation method.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub SapLogon()&lt;br /&gt;&lt;br /&gt;Dim sapConn As Object 'Declare variant&lt;br /&gt;Set sapConn = CreateObject("SAP.Functions") 'Create ActiveX object&lt;br /&gt;&lt;br /&gt;sapConn.Connection.RfcWithDialog = 1&lt;br /&gt;If sapConn.Connection.Logon(0, False) &lt;&gt; True Then 'Try Logon&lt;br /&gt;   &lt;strong&gt;sapConn.Connection.SystemMessages&lt;/strong&gt;&lt;br /&gt;End If&lt;br /&gt;&lt;strong&gt;sapConn.Connection.SystemInformation&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113175921991433009?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113175921991433009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113175921991433009' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113175921991433009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113175921991433009'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/11/saprfc-logon-to-sap-6-show-system-info.html' title='SAPRFC - Logon to SAP 6 - Show system info'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113175873928710189</id><published>2005-11-07T17:20:00.000-08:00</published><updated>2005-11-11T17:34:09.246-08:00</updated><title type='text'>SAPRFC - Logon to SAP 5 - With dialog</title><content type='html'>In some case, you may have to show SAP screen during the process of the RFC. Also, there may be a case you have to upload/download files between SAP and client. This RfcWithDialog parameter enables to make it.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub SapLogon()&lt;br /&gt;&lt;br /&gt;Dim sapConn As Object 'Declare variant&lt;br /&gt;Set sapConn = CreateObject("SAP.Functions") 'Create ActiveX object&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;sapConn.Connection.RfcWithDialog = 1&lt;/strong&gt;&lt;br /&gt;If sapConn.Connection.Logon(0, False) &lt;&gt; True Then 'Try Logon&lt;br /&gt;   MsgBox "Error": Exit Sub&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113175873928710189?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113175873928710189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113175873928710189' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113175873928710189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113175873928710189'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/11/saprfc-logon-to-sap-5-with-dialog.html' title='SAPRFC - Logon to SAP 5 - With dialog'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113175836345245928</id><published>2005-11-06T17:15:00.000-08:00</published><updated>2005-11-11T17:34:20.696-08:00</updated><title type='text'>SAPRFC - Logon to SAP 4 - With logon selection</title><content type='html'>By giving "False" to SilentLogon parameter of Logon method, we can show logon dialog and ask users to select the system to logon. This may be easier if you are going to develop a tool running on users' client.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub SapLogon()&lt;br /&gt;&lt;br /&gt;Dim sapConn As Object 'Declare variant&lt;br /&gt;Set sapConn = CreateObject("SAP.Functions") 'Create ActiveX object&lt;br /&gt;&lt;br /&gt;If sapConn.Connection.Logon(0, &lt;strong&gt;False&lt;/strong&gt;) &lt;&gt; True Then 'Try Logon&lt;br /&gt;   MsgBox "Error": Exit Sub&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113175836345245928?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113175836345245928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113175836345245928' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113175836345245928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113175836345245928'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/11/saprfc-logon-to-sap-4-with-logon.html' title='SAPRFC - Logon to SAP 4 - With logon selection'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113175806351782525</id><published>2005-11-05T17:12:00.000-08:00</published><updated>2005-11-11T21:30:18.143-08:00</updated><title type='text'>SAPRFC - Logon to SAP 3</title><content type='html'>Third alternative to logon to SAP is to use the BAPI contorl function. This should be used when you have a code with BAPI function. (You can call BAPI function as RFC function module. So it's just about a preference though.)&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub SapLogon3()&lt;br /&gt;&lt;br /&gt;Dim sapBapi As Object&lt;br /&gt;&lt;br /&gt;Set sapBapi = CreateObject("SAP.BAPI.1")&lt;br /&gt;&lt;br /&gt;sapBapi.Connection.User = "TEST"&lt;br /&gt;sapBapi.Connection.Password = "PASSWORD"&lt;br /&gt;sapBapi.Connection.Client = "999"&lt;br /&gt;sapBapi.Connection.ApplicationServer = "sapass.metro.client.jp"&lt;br /&gt;sapBapi.Connection.Language = "EN"&lt;br /&gt;&lt;br /&gt;If sapBapi.Connection.Logon(0, True) &lt;&gt; True Then&lt;br /&gt;   MsgBox "Error"&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113175806351782525?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113175806351782525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113175806351782525' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113175806351782525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113175806351782525'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/11/saprfc-logon-to-sap-3.html' title='SAPRFC - Logon to SAP 3'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113175785487161709</id><published>2005-11-03T17:08:00.000-08:00</published><updated>2005-11-11T21:30:04.320-08:00</updated><title type='text'>SAPRFC - Logon to SAP 2</title><content type='html'>This is also for logging on to SAP but this uses SAP Logon Control function. May be useful to connect to SAP multiple times at the same time.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub SapLogon2()&lt;br /&gt;&lt;br /&gt;Dim objBase As Object 'Connection base&lt;br /&gt;Dim sapConn As Object&lt;br /&gt;Set objBase = CreateObject("SAP.LogonControl.1") 'Create ActiveX&lt;br /&gt;&lt;br /&gt;objBase.User = "TEST"&lt;br /&gt;objBase.Password = "PASSWORD"&lt;br /&gt;objBase.Client = "999"&lt;br /&gt;objBase.ApplicationServer = "sapass.metro.client.jp"&lt;br /&gt;objBase.Language = "EN"&lt;br /&gt;Set sapConn = objBase.NewConnection&lt;br /&gt;&lt;br /&gt;If sapConn.Logon(0, True) &lt;&gt; True Then 'Try Logon&lt;br /&gt;   MsgBox "Error"&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113175785487161709?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113175785487161709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113175785487161709' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113175785487161709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113175785487161709'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/11/saprfc-logon-to-sap-2.html' title='SAPRFC - Logon to SAP 2'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113175767752997083</id><published>2005-11-01T17:06:00.000-08:00</published><updated>2005-11-11T21:29:43.860-08:00</updated><title type='text'>SAPRFC - Logon to SAP 1</title><content type='html'>Here is the basic function to logon to SAP. This utilizes the SAP RFC function control.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub SapLogon()&lt;br /&gt;&lt;br /&gt;Dim sapConn As Object 'Declare variant&lt;br /&gt;Set sapConn = CreateObject("SAP.Functions") 'Create ActiveX&lt;br /&gt;&lt;br /&gt;sapConn.Connection.User = "TEST"&lt;br /&gt;sapConn.Connection.Password = "PASSWORD"&lt;br /&gt;sapConn.Connection.Client = "999"&lt;br /&gt;sapConn.Connection.ApplicationServer = "sapass.metro.client.jp"&lt;br /&gt;sapConn.Connection.Language = "EN"&lt;br /&gt;&lt;br /&gt;If sapConn.Connection.Logon(0, True) &lt;&gt; True Then 'Try Logon&lt;br /&gt;   MsgBox "Error"&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113175767752997083?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113175767752997083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113175767752997083' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113175767752997083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113175767752997083'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/11/saprfc-logon-to-sap-1.html' title='SAPRFC - Logon to SAP 1'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113125469443203305</id><published>2005-10-24T21:21:00.000-07:00</published><updated>2005-11-05T21:24:54.433-08:00</updated><title type='text'>XL - Status bar</title><content type='html'>Sometimes it is tedious to create progress bar in user format. In that case, we can use status bar instead.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim lngIdx As Long&lt;br /&gt;Dim strPrev As String&lt;br /&gt;Dim blnPrev As Boolean&lt;br /&gt;strPrev = Application.StatusBar&lt;br /&gt;For lngIdx = 1 To 100&lt;br /&gt;  Application.StatusBar = "Counting .. " &amp; lngIdx&lt;br /&gt;Next&lt;br /&gt;Application.StatusBar = strPrev&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113125469443203305?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113125469443203305/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113125469443203305' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113125469443203305'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113125469443203305'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/xl-status-bar.html' title='XL - Status bar'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113125437477688991</id><published>2005-10-23T21:18:00.000-07:00</published><updated>2005-11-05T21:19:34.776-08:00</updated><title type='text'>XL - Execute macro on another book</title><content type='html'>In order to execute a macro on another sheet, we have to do "Run" instead of "Call".&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Application.Run "Book2!Temp2"&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113125437477688991?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113125437477688991/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113125437477688991' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113125437477688991'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113125437477688991'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/xl-execute-macro-on-another-book.html' title='XL - Execute macro on another book'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113125205736225771</id><published>2005-10-21T20:38:00.000-07:00</published><updated>2005-11-05T20:40:57.363-08:00</updated><title type='text'>XL - List up built in properties (Author etc..)</title><content type='html'>This sub procedure lists up all the built-in properties in Excel workbook. Which covers, Title, Subject, Company, Author, Creation date, Last save time etc...&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim objProperty As Object&lt;br /&gt;On Error Resume Next&lt;br /&gt;For Each objProperty In ActiveWorkbook.BuiltinDocumentProperties&lt;br /&gt;   Debug.Print objProperty.Name &amp; " = " &amp; objProperty.Value&lt;br /&gt;Next&lt;br /&gt;On Error GoTo 0&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113125205736225771?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113125205736225771/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113125205736225771' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113125205736225771'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113125205736225771'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/xl-list-up-built-in-properties-author.html' title='XL - List up built in properties (Author etc..)'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113125138451998565</id><published>2005-10-20T20:28:00.000-07:00</published><updated>2005-11-05T20:29:44.530-08:00</updated><title type='text'>XL - List up all menus incl. sub menu</title><content type='html'>Here this script helps to list up the menus in Excel. Some menu hidden but can be checked with this.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub ListUp()&lt;br /&gt;Dim objBar As Object&lt;br /&gt;&lt;br /&gt;For Each objBar In CommandBars&lt;br /&gt;   Debug.Print "1 : " &amp; objBar.Name&lt;br /&gt;   ListSubMenu objSubMenu:=objBar.Controls, lngLevel:=1&lt;br /&gt;Next&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Sub ListSubMenu(objSubMenu As Object, lngLevel As Long)&lt;br /&gt;Dim objBar As Object&lt;br /&gt;On Error Resume Next&lt;br /&gt;For Each objBar In objSubMenu&lt;br /&gt;   Debug.Print lngLevel &amp; " : " &amp; objBar.Caption&lt;br /&gt;   If objBar.Controls.Count &gt; 0 Then&lt;br /&gt;      ListSubMenu objSubMenu:=objBar.Controls, lngLevel:=lngLevel + 1&lt;br /&gt;   End If&lt;br /&gt;Next&lt;br /&gt;On Error GoTo 0&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113125138451998565?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113125138451998565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113125138451998565' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113125138451998565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113125138451998565'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/xl-list-up-all-menus-incl-sub-menu.html' title='XL - List up all menus incl. sub menu'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113125062975541350</id><published>2005-10-18T20:16:00.000-07:00</published><updated>2005-11-05T20:17:09.766-08:00</updated><title type='text'>XL - List up menus</title><content type='html'>This scripts list up menus included in Excel.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim objBar As Object&lt;br /&gt;For Each objBar In CommandBars&lt;br /&gt;   Debug.Print objBar.Name&lt;br /&gt;Next&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113125062975541350?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113125062975541350/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113125062975541350' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113125062975541350'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113125062975541350'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/xl-list-up-menus.html' title='XL - List up menus'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113124760415356470</id><published>2005-10-17T19:18:00.000-07:00</published><updated>2005-11-05T19:26:44.153-08:00</updated><title type='text'>XL - Comparison of the string 2</title><content type='html'>For comparing the pattern of the string, we can use "like" operator. "*" stands for any string character with any length and "?" stands for single character.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;&lt;br /&gt;Const strA1 = "ABCD"&lt;br /&gt;Const strA2 = "ABXD"&lt;br /&gt;Const strA3 = "AXCD"&lt;br /&gt;Const strB = "AB*"&lt;br /&gt;Const strC = "A?C?"&lt;br /&gt;&lt;br /&gt;MsgBox "Compare " &amp; strA1 &amp; " &amp; " &amp; strB &amp; " - " &amp; (strA1 Like strB)&lt;br /&gt;MsgBox "Compare " &amp; strA1 &amp; " &amp; " &amp; strC &amp; " - " &amp; (strA1 Like strC)&lt;br /&gt;MsgBox "Compare " &amp; strA2 &amp; " &amp; " &amp; strB &amp; " - " &amp; (strA2 Like strB)&lt;br /&gt;MsgBox "Compare " &amp; strA2 &amp; " &amp; " &amp; strC &amp; " - " &amp; (strA2 Like strC)&lt;br /&gt;MsgBox "Compare " &amp; strA3 &amp; " &amp; " &amp; strB &amp; " - " &amp; (strA3 Like strB)&lt;br /&gt;MsgBox "Compare " &amp; strA3 &amp; " &amp; " &amp; strC &amp; " - " &amp; (strA3 Like strC)&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113124760415356470?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113124760415356470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113124760415356470' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113124760415356470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113124760415356470'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/xl-comparison-of-string-2.html' title='XL - Comparison of the string 2'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113124710412853910</id><published>2005-10-16T19:10:00.000-07:00</published><updated>2005-11-05T19:18:24.166-08:00</updated><title type='text'>XL - Comparison of the string 1</title><content type='html'>For comparing string, StrComp function is availabe.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Const strA = "ABCD"&lt;br /&gt;Const strB = "abcd"&lt;br /&gt;MsgBox strA = strB  'Not equal - Char code comparison (binary)&lt;br /&gt;MsgBox StrComp(strA, strB, 0) = 0 'Not equal - Binary comparison&lt;br /&gt;MsgBox StrComp(strA, strB, 1) = 0 'Equal - Textual comparison&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113124710412853910?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113124710412853910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113124710412853910' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113124710412853910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113124710412853910'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/xl-comparison-of-string-1.html' title='XL - Comparison of the string 1'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113123850326013533</id><published>2005-10-14T16:53:00.000-07:00</published><updated>2005-11-05T16:55:03.260-08:00</updated><title type='text'>Folder - List up items in Temporary Internet folder</title><content type='html'>This script helps to list up items in Temporary Internet file folder.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim objShell As Object&lt;br /&gt;Dim objFolder As Object&lt;br /&gt;Dim objItem As Object&lt;br /&gt;Dim objFolderItem As Object&lt;br /&gt;Const TEMPORARY_INTERNET_FILES = &amp;H20&amp;&lt;br /&gt;&lt;br /&gt;Set objShell = CreateObject("Shell.Application")&lt;br /&gt;Set objFolder = objShell.Namespace(TEMPORARY_INTERNET_FILES)&lt;br /&gt;Set objFolderItem = objFolder.Self&lt;br /&gt;Debug.Print objFolderItem.Path&lt;br /&gt;&lt;br /&gt;For Each objItem In objFolder.Items&lt;br /&gt;    Debug.Print objItem.Name&lt;br /&gt;Next&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113123850326013533?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113123850326013533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113123850326013533' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113123850326013533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113123850326013533'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/folder-list-up-items-in-temporary.html' title='Folder - List up items in Temporary Internet folder'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113123801299712573</id><published>2005-10-12T16:45:00.000-07:00</published><updated>2005-11-05T16:48:44.470-08:00</updated><title type='text'>Folder - List up items in Recycle bin</title><content type='html'>This snippet lists up the files in Recycle bin.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim objShell As Object&lt;br /&gt;Dim objFolder As Object&lt;br /&gt;Dim objItem As Object&lt;br /&gt;Dim objFolderItem As Object&lt;br /&gt;Const RECYCLE_BIN = &amp;HA&amp;&lt;br /&gt;&lt;br /&gt;Set objShell = CreateObject("Shell.Application")&lt;br /&gt;Set objFolder = objShell.Namespace(RECYCLE_BIN)&lt;br /&gt;Set objFolderItem = objFolder.Self&lt;br /&gt;Debug.Print objFolderItem.Path&lt;br /&gt;&lt;br /&gt;For Each objItem In objFolder.Items&lt;br /&gt;    Debug.Print objItem.Name&lt;br /&gt;Next&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113123801299712573?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113123801299712573/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113123801299712573' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113123801299712573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113123801299712573'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/folder-list-up-items-in-recycle-bin.html' title='Folder - List up items in Recycle bin'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113123790103402402</id><published>2005-10-11T16:43:00.000-07:00</published><updated>2005-11-05T16:45:01.046-08:00</updated><title type='text'>Folder - List up items in System32</title><content type='html'>Here this script lists up the files in System32.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub temp()&lt;br /&gt;Dim objShell As Object&lt;br /&gt;Dim objFolder As Object&lt;br /&gt;Dim objFolderItem As Object&lt;br /&gt;Dim objItem As Object&lt;br /&gt;Const SYSTEM32 = &amp;H25&amp;&lt;br /&gt;&lt;br /&gt;Set objShell = CreateObject("Shell.Application")&lt;br /&gt;Set objFolder = objShell.Namespace(SYSTEM32)&lt;br /&gt;Set objFolderItem = objFolder.Self&lt;br /&gt;Debug.Print objFolderItem.Path&lt;br /&gt;&lt;br /&gt;For Each objItem In objFolder.Items&lt;br /&gt;    Debug.Print objItem.Name&lt;br /&gt;Next&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113123790103402402?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113123790103402402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113123790103402402' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113123790103402402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113123790103402402'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/folder-list-up-items-in-system32.html' title='Folder - List up items in System32'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113119214381055162</id><published>2005-10-10T04:00:00.000-07:00</published><updated>2005-11-05T04:02:23.810-08:00</updated><title type='text'>Windows - Get module name</title><content type='html'>Module name that the specified windows is using can be obtained by the snippet below. The usage of the formula is as follows:&lt;br /&gt;=GetModuleName(0)&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Private Declare Function GetModuleFileName Lib "kernel32" Alias _&lt;br /&gt;           "GetModuleFileNameA" (ByVal hModule As Long, ByVal lpFileName As _&lt;br /&gt;           String, ByVal nSize As Long) As Long&lt;br /&gt;&lt;br /&gt;Function GetModuleName(hInstance As Long) As String&lt;br /&gt;Dim lngReturn As Long&lt;br /&gt;Dim strModule As String * 100&lt;br /&gt;lngReturn = GetModuleFileName(hInstance, strModule, 100)&lt;br /&gt;GetModuleName = Left(strModule, lngReturn)&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113119214381055162?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113119214381055162/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113119214381055162' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113119214381055162'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113119214381055162'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/windows-get-module-name.html' title='Windows - Get module name'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113119194882595825</id><published>2005-10-09T03:57:00.000-07:00</published><updated>2005-11-05T03:59:08.840-08:00</updated><title type='text'>Windows - Get instance number</title><content type='html'>We can get Instance number of the window handle by the function below. The function can be called as:&lt;br /&gt;=GetWindowInstance(GetWindowFromPoint(200,200))&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Private Declare Function GetWindowWord Lib "User32" (ByVal hwnd As _&lt;br /&gt;           Long, ByVal nIndex As Long) As Integer&lt;br /&gt;Const GWW_HINSTANCE = (-6)&lt;br /&gt;           &lt;br /&gt;Function GetWindowInstance(hwnd As Long) As Long&lt;br /&gt;GetWindowInstance = GetWindowWord(hwnd, GWW_HINSTANCE)&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113119194882595825?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113119194882595825/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113119194882595825' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113119194882595825'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113119194882595825'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/windows-get-instance-number.html' title='Windows - Get instance number'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113119005456431208</id><published>2005-10-07T03:26:00.000-07:00</published><updated>2005-11-05T03:27:34.563-08:00</updated><title type='text'>Windows - Get class name</title><content type='html'>This function gets class name by window handle. The function can be used:&lt;br /&gt;=GetClassFromHandle(GetWindowFromPoint(200,200))&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Private Declare Function GetClassName Lib "User32" Alias _&lt;br /&gt;           "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As _&lt;br /&gt;           String, ByVal nMaxCount As Long) As Long&lt;br /&gt;           &lt;br /&gt;Function GetClassFromHandle(hwnd As Long) As String&lt;br /&gt;Dim lngReturn As Long&lt;br /&gt;Dim strClass As String * 100&lt;br /&gt;lngReturn = GetClassName(hwnd, strClass, 100)&lt;br /&gt;GetClassFromHandle = Left(strClass, lngReturn)&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113119005456431208?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113119005456431208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113119005456431208' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113119005456431208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113119005456431208'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/windows-get-class-name.html' title='Windows - Get class name'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113118973828463478</id><published>2005-10-06T03:19:00.000-07:00</published><updated>2005-11-05T03:22:18.306-08:00</updated><title type='text'>Windows - Get window text</title><content type='html'>This function obtains window text from window handle. With the combination of the other function, this can be used as below.&lt;br /&gt;=GetWindowTextFromHandle(GetWindowFromPoint(200,200))&lt;br /&gt;*GetWindowFromPoint is a function that returns window handle by window position.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Private Declare Function GetWindowText Lib "User32" Alias _&lt;br /&gt;           "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, _&lt;br /&gt;           ByVal cch As Long) As Long&lt;br /&gt;&lt;br /&gt;Function GetWindowTextFromHandle(hWnd As Long) As String&lt;br /&gt;Dim lngReturn As Long&lt;br /&gt;Dim strText As String * 100&lt;br /&gt;lngReturn = GetWindowText(hWnd, strText, 100)&lt;br /&gt;GetWindowTextFromHandle = Left(strText, lngReturn)&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113118973828463478?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113118973828463478/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113118973828463478' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113118973828463478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113118973828463478'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/windows-get-window-text.html' title='Windows - Get window text'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113118834049688933</id><published>2005-10-04T02:06:00.000-07:00</published><updated>2005-11-05T02:59:01.030-08:00</updated><title type='text'>Windows - Get window handle</title><content type='html'>This function returns the window handle number which the parameter X and Y indicates. The usage of the function is:&lt;br /&gt;=GetWindowFromPoint(100, 100)&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Private Declare Function WindowFromPointXY Lib "User32" Alias _&lt;br /&gt;     "WindowFromPoint" (ByVal xPoint As Long, ByVal yPoint As Long) _&lt;br /&gt;     As Long&lt;br /&gt;&lt;br /&gt;Function GetWindowFromPoint(lngX As Long, lngY As Long) As Long&lt;br /&gt;GetWindowFromPoint = WindowFromPointXY(lngX, lngY)&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113118834049688933?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113118834049688933/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113118834049688933' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113118834049688933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113118834049688933'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/windows-get-window-handle.html' title='Windows - Get window handle'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113118486758985958</id><published>2005-10-03T01:57:00.000-07:00</published><updated>2005-11-05T02:01:44.136-08:00</updated><title type='text'>Date - Split date into sub-part : DatePart</title><content type='html'>For split date into Year, Month, Day or any units, you can use the function DatePart. The result you can get may be same as Year, Month, Day function, but you can make the unit of value as varible.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;result = DatePart("", "2005/10/1")&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;yyyy - Year &lt;br /&gt;q - Quarter &lt;br /&gt;m - Month &lt;br /&gt;y - Day of year &lt;br /&gt;d - Day &lt;br /&gt;w - Weekday &lt;br /&gt;ww - Week &lt;br /&gt;h - Hour &lt;br /&gt;n - Minute &lt;br /&gt;s - Second&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113118486758985958?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113118486758985958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113118486758985958' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113118486758985958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113118486758985958'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/date-split-date-into-sub-part-datepart.html' title='Date - Split date into sub-part : DatePart'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113118455475717610</id><published>2005-10-02T01:53:00.000-07:00</published><updated>2005-11-05T01:57:09.986-08:00</updated><title type='text'>Date - Date calculation : DateAdd</title><content type='html'>Date calculation is done by DateAdd function.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;result = DateAdd(interval, 10, "2005/1/1")&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Possible values for interval.&lt;br /&gt;yyyy - Year &lt;br /&gt;q - Quarter &lt;br /&gt;m - Month &lt;br /&gt;y - Day of year &lt;br /&gt;d - Day &lt;br /&gt;w - Weekday &lt;br /&gt;ww - Week &lt;br /&gt;h - Hour &lt;br /&gt;n - Minute &lt;br /&gt;s - Second&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113118455475717610?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113118455475717610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113118455475717610' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113118455475717610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113118455475717610'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/date-date-calculation-dateadd.html' title='Date - Date calculation : DateAdd'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113118435033385427</id><published>2005-10-01T01:45:00.000-07:00</published><updated>2005-11-05T01:56:18.993-08:00</updated><title type='text'>Date - Difference of two dates: Datediff</title><content type='html'>Datediff is a function for calculating the difference betweeen two dates. The unit of the difference can be year, month, day or etc... The format of the function is as below.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;result = DateDiff(interval, "2005/1/1", "2005/10/1")&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Possible values for interval:&lt;br /&gt;yyyy - Year &lt;br /&gt;q - Quarter &lt;br /&gt;m - Month &lt;br /&gt;y - Day of year &lt;br /&gt;d - Day &lt;br /&gt;w - Weekday &lt;br /&gt;ww - Week &lt;br /&gt;h - Hour &lt;br /&gt;n - Minute &lt;br /&gt;s - Second&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113118435033385427?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113118435033385427/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113118435033385427' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113118435033385427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113118435033385427'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/10/date-difference-of-two-dates-datediff.html' title='Date - Difference of two dates: Datediff'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113117905663352810</id><published>2005-09-30T00:23:00.000-07:00</published><updated>2005-11-05T00:24:16.653-08:00</updated><title type='text'>WSH - Get environment variables</title><content type='html'>Windows environment variables can be obtained as floows.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim objShell As Object&lt;br /&gt;Dim varEnv As Variant&lt;br /&gt;Set objShell = CreateObject("WScript.Shell")&lt;br /&gt;For Each varEnv In objShell.Environment&lt;br /&gt;   Debug.Print varEnv&lt;br /&gt;Next&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113117905663352810?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113117905663352810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113117905663352810' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117905663352810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117905663352810'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/wsh-get-environment-variables.html' title='WSH - Get environment variables'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113117837724917693</id><published>2005-09-28T00:11:00.000-07:00</published><updated>2005-11-05T00:12:57.250-08:00</updated><title type='text'>WSH - Registry manipulation : Read</title><content type='html'>Reading value from the registry can be done throught the snippet below.&lt;br /&gt;=ReadRegistry("temp\temp")&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Function ReadRegistry(strkey As String, Optional strRoot As String) As String&lt;br /&gt;Dim objShell As Object&lt;br /&gt;ReadRegistry = ""&lt;br /&gt;Set objShell = CreateObject("WScript.Shell")&lt;br /&gt;strRoot = IIf(strRoot = "", "HKEY_CURRENT_USER\", strRoot)&lt;br /&gt;ReadRegistry = objShell.RegRead(strRoot &amp; strkey)&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113117837724917693?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113117837724917693/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113117837724917693' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117837724917693'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117837724917693'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/wsh-registry-manipulation-read.html' title='WSH - Registry manipulation : Read'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113117815312195714</id><published>2005-09-27T00:05:00.000-07:00</published><updated>2005-11-05T00:09:13.120-08:00</updated><title type='text'>WSH - Registry manipulation : Delete</title><content type='html'>Deletion of the registry value/key can also be done with WSH. Here the function works with the code below:&lt;br /&gt;=DeleteRegistry("temp\") &lt;br /&gt;This removes all the keys/values under "temp". &lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Function DeleteRegistry(strKey As String, Optional strRoot As String)&lt;br /&gt;Dim objShell As Object&lt;br /&gt;Set objShell = CreateObject("WScript.Shell")&lt;br /&gt;DeleteRegistry = 0&lt;br /&gt;strRoot = IIf(strRoot = "", "HKEY_CURRENT_USER\", strRoot)&lt;br /&gt;objShell.RegDelete strRoot &amp; strKey&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113117815312195714?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113117815312195714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113117815312195714' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117815312195714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117815312195714'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/wsh-registry-manipulation-delete.html' title='WSH - Registry manipulation : Delete'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113117751011145587</id><published>2005-09-26T23:56:00.000-07:00</published><updated>2005-11-05T00:05:26.130-08:00</updated><title type='text'>WSH - Registry manipulation : Add</title><content type='html'>Even with WSH, you can add, delete or get the registry value. This is easier than to write a code which calls dlls. This function works like this.&lt;br /&gt;=AddRegistry("temp\temp","tempvalue")&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Function AddRegistry(strKey As String, strValue As String, Optional strRoot As String)&lt;br /&gt;Dim objShell As Object&lt;br /&gt;AddRegistry = 0&lt;br /&gt;Set objShell = CreateObject("WScript.Shell")&lt;br /&gt;strRoot = IIf(strRoot = "", "HKEY_CURRENT_USER\", strRoot)&lt;br /&gt;objShell.RegWrite strRoot &amp; strKey, strValue&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113117751011145587?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113117751011145587/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113117751011145587' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117751011145587'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117751011145587'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/wsh-registry-manipulation-add.html' title='WSH - Registry manipulation : Add'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113117701139495519</id><published>2005-09-24T23:49:00.000-07:00</published><updated>2005-11-04T23:50:11.396-08:00</updated><title type='text'>WSH - Removing Network drive</title><content type='html'>Same as doing printers, removing a Network to client can be done with the script below.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim objNet As Object&lt;br /&gt;Set objNet = CreateObject("WScript.Network") &lt;br /&gt;objNet.AddWindowsPrinterConnection "\\Server\Printer"&lt;br /&gt;objNet.RemoveNetworkDrive "Z:"&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113117701139495519?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113117701139495519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113117701139495519' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117701139495519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117701139495519'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/wsh-removing-network-drive.html' title='WSH - Removing Network drive'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113117683563597545</id><published>2005-09-23T23:47:00.000-07:00</published><updated>2005-11-04T23:48:56.910-08:00</updated><title type='text'>WSH - Map network drive</title><content type='html'>Same as doing printers, adding a Network to client can be done with the script below.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim objNet As Object&lt;br /&gt;Set objNet = CreateObject("WScript.Network")    &lt;br /&gt;objNet.AddWindowsPrinterConnection "\\Server\Printer"&lt;br /&gt;objNet.MapNetworkDrive "Z:", "\\Server\Folder","True","user","password"&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113117683563597545?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113117683563597545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113117683563597545' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117683563597545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117683563597545'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/wsh-map-network-drive.html' title='WSH - Map network drive'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113117671869693303</id><published>2005-09-22T23:44:00.000-07:00</published><updated>2005-11-04T23:46:25.623-08:00</updated><title type='text'>WSH - Remove printer</title><content type='html'>Removing a printer from a client can be done with the script below.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim objNet As Object&lt;br /&gt;Set objNet = CreateObject("WScript.Network") &lt;br /&gt;objNet.RemovePrinterConnection "\\Server\Printer"&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113117671869693303?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113117671869693303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113117671869693303' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117671869693303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117671869693303'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/wsh-remove-printer.html' title='WSH - Remove printer'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113117663886400840</id><published>2005-09-21T23:42:00.000-07:00</published><updated>2005-11-04T23:46:44.146-08:00</updated><title type='text'>WSH - Add printer</title><content type='html'>Adding a printer to client can be done with the script below.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim objNet As Object&lt;br /&gt;Set objNet = CreateObject("WScript.Network")    &lt;br /&gt;objNet.AddWindowsPrinterConnection "\\Server\Printer"&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113117663886400840?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113117663886400840/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113117663886400840' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117663886400840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117663886400840'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/wsh-add-printer.html' title='WSH - Add printer'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113117646546734307</id><published>2005-09-20T23:39:00.000-07:00</published><updated>2005-11-04T23:41:05.466-08:00</updated><title type='text'>WSH - Get login information</title><content type='html'>Instead of using dll, you can get username, domain and computer name through Windows Script.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim objNet As Object&lt;br /&gt;Set objNet = CreateObject("WScript.Network")&lt;br /&gt;Debug.Print objNet.UserName&lt;br /&gt;Debug.Print objNet.UserDomain&lt;br /&gt;Debug.Print objNet.ComputerName&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113117646546734307?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113117646546734307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113117646546734307' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117646546734307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117646546734307'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/wsh-get-login-information.html' title='WSH - Get login information'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113117631843398050</id><published>2005-09-19T23:37:00.000-07:00</published><updated>2005-11-04T23:38:38.433-08:00</updated><title type='text'>WSH - List up Network drives</title><content type='html'>Same as listing up printers, Network drives can be listed up with the code below.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim objNet As Object&lt;br /&gt;Dim objDrives As Object&lt;br /&gt;Dim varDrive As Variant&lt;br /&gt;Set objNet = CreateObject("WScript.Network")&lt;br /&gt;Set objDrives = objNet.EnumNetworkDrives&lt;br /&gt;For Each varDrive In objDrives&lt;br /&gt;   Debug.Print varDrive&lt;br /&gt;Next&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113117631843398050?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113117631843398050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113117631843398050' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117631843398050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117631843398050'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/wsh-list-up-network-drives.html' title='WSH - List up Network drives'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113117619513662741</id><published>2005-09-18T23:35:00.000-07:00</published><updated>2005-11-04T23:36:35.146-08:00</updated><title type='text'>WSH - List up printers connected to client</title><content type='html'>For list up the printers connected to the client, you can do it through Windows Script Hosting (WSH). This function utilize OCX library - wshom.ocx.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim objNet As Object&lt;br /&gt;Dim objPrinters As Object&lt;br /&gt;Dim varPrinter As Variant&lt;br /&gt;Set objNet = CreateObject("WScript.Network")&lt;br /&gt;Set objPrinters = objNet.EnumPrinterConnections&lt;br /&gt;For Each varPrinter In objPrinters&lt;br /&gt;   Debug.Print varPrinter&lt;br /&gt;Next&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113117619513662741?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113117619513662741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113117619513662741' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117619513662741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117619513662741'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/wsh-list-up-printers-connected-to.html' title='WSH - List up printers connected to client'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113117107244897675</id><published>2005-09-17T22:09:00.000-07:00</published><updated>2005-11-04T22:13:03.010-08:00</updated><title type='text'>XL - Open URL 2</title><content type='html'>Another way to open URL. Here we use WSH (Windows script) technology. Other than these, we can specificly open Internet explorer by creating ActiveX object, but not all of the users are using IE as standard web browser so these 2 are recommended.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim objWsh as Object&lt;br /&gt;Set objWsh = CreateObject("Wscript.Shell")&lt;br /&gt;objWsh.Run "http://sapass.metro.client.jp", 3&lt;br /&gt;Set objWsh = Nothing&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113117107244897675?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113117107244897675/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113117107244897675' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117107244897675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117107244897675'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/xl-open-url-2.html' title='XL - Open URL 2'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113117096019238584</id><published>2005-09-16T22:05:00.000-07:00</published><updated>2005-11-04T22:09:20.193-08:00</updated><title type='text'>XL - Open URL 1</title><content type='html'>Sometimes we want to bring users to specific URL site.. like to show help texts to users. In that case, we want to show the site automatically. Here we will see how to make it. In this case, let windows judge which application to use for accessing web.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _&lt;br /&gt;  (ByVal hwnd As Long, ByVal lpOperation As String, _&lt;br /&gt;   ByVal lpFile As String, ByVal lpParameters As String, _&lt;br /&gt;   ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long&lt;br /&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim strURL As String&lt;br /&gt;Dim lngReturn as long&lt;br /&gt;strURL = "http://sapass.metro.client.jp"&lt;br /&gt;lngReturn = ShellExecute(0, "Open", strURL, "", "", 1)&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113117096019238584?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113117096019238584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113117096019238584' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117096019238584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117096019238584'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/xl-open-url-1.html' title='XL - Open URL 1'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113117044438019892</id><published>2005-09-15T22:00:00.000-07:00</published><updated>2005-11-04T22:03:49.363-08:00</updated><title type='text'>XL - RefEdit control</title><content type='html'>In Excel user form, you may ever have faced a case to include dialog to let users to specify the range in the spreadsheet. The RefEdit control helps you to do that. The control is provided by the "REFEDIT.dll" in the MS office packages. This is an example for using it in the user form. (It does nothing though.)&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;VERSION 5.00&lt;br /&gt;Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} UserForm &lt;br /&gt;   Caption         =   "UserForm1"&lt;br /&gt;   ClientHeight    =   525&lt;br /&gt;   ClientLeft      =   45&lt;br /&gt;   ClientTop       =   330&lt;br /&gt;   ClientWidth     =   4170&lt;br /&gt;   OleObjectBlob   =   "UserForm.frx":0000&lt;br /&gt;   StartUpPosition =   1  'CenterOwner&lt;br /&gt;End&lt;br /&gt;Attribute VB_Name = "UserForm"&lt;br /&gt;Attribute VB_GlobalNameSpace = False&lt;br /&gt;Attribute VB_Creatable = False&lt;br /&gt;Attribute VB_PredeclaredId = True&lt;br /&gt;Attribute VB_Exposed = False&lt;br /&gt;Option Explicit&lt;br /&gt;&lt;br /&gt;Private Sub CancelButton_Click()&lt;br /&gt;Hide&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113117044438019892?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113117044438019892/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113117044438019892' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117044438019892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117044438019892'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/xl-refedit-control.html' title='XL - RefEdit control'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113117009210615502</id><published>2005-09-14T21:50:00.000-07:00</published><updated>2005-11-04T21:55:56.193-08:00</updated><title type='text'>XL - Display progress bar</title><content type='html'>Progress bar can be built in the form with the "mscomctl.ocx" library. The form below "Progress.frm" shows how to control it in VBA form. This form contains 3 methods and 2 events.&lt;br /&gt;1. Init - Initializes the progress bar. &lt;br /&gt;2. Update - Updates with Current position, Max position and comment.&lt;br /&gt;3. Complete - Show complete status. &lt;br /&gt;4. ButtonCancel_Click - Triggered when Cancel button hit.&lt;br /&gt;5. ButtonOk_Click - Triggered when Ok button hit.&lt;br /&gt;&lt;br /&gt;mscomctl.ocx contains lots more functions we can use.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;VERSION 5.00&lt;br /&gt;Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} Progress &lt;br /&gt;   Caption         =   "Progress"&lt;br /&gt;   ClientHeight    =   1905&lt;br /&gt;   ClientLeft      =   45&lt;br /&gt;   ClientTop       =   330&lt;br /&gt;   ClientWidth     =   4710&lt;br /&gt;   OleObjectBlob   =   "Progress.frx":0000&lt;br /&gt;   ShowModal       =   0   'False&lt;br /&gt;   StartUpPosition =   1  'CenterOwner&lt;br /&gt;End&lt;br /&gt;Attribute VB_Name = "Progress"&lt;br /&gt;Attribute VB_GlobalNameSpace = False&lt;br /&gt;Attribute VB_Creatable = False&lt;br /&gt;Attribute VB_PredeclaredId = True&lt;br /&gt;Attribute VB_Exposed = False&lt;br /&gt;Option Explicit&lt;br /&gt;Public OkCancel As Long&lt;br /&gt;&lt;br /&gt;Private Sub ButtonOk_Click()&lt;br /&gt;Hide&lt;br /&gt;OkCancel = vbOK&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Private Sub ButtonCancel_Click()&lt;br /&gt;If MsgBox("Do you want to stop this process?", vbYesNo) = vbYes Then&lt;br /&gt;   Hide&lt;br /&gt;   OkCancel = vbCancel&lt;br /&gt;End If&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Sub Init(Process)&lt;br /&gt;OkCancel = vbOK&lt;br /&gt;ButtonOk.Enabled = False&lt;br /&gt;ButtonCancel.Enabled = True&lt;br /&gt;ProgressBar.Value = 0&lt;br /&gt;PercentText = "0%"&lt;br /&gt;TitleText = Process&lt;br /&gt;Show&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Sub Update(Optional CurNum, Optional MaxNum, Optional OtherInfo)&lt;br /&gt;CommentText = "Processing: " &amp; OtherInfo&lt;br /&gt;If MaxNum &gt; 0 Then&lt;br /&gt;   ProgressBar.Value = (CurNum / MaxNum) * 100&lt;br /&gt;   PercentText = CInt((CurNum / MaxNum) * 100) &amp; "%"&lt;br /&gt;   Repaint&lt;br /&gt;End If&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;Sub Complete()&lt;br /&gt;ButtonOk.Enabled = True&lt;br /&gt;ButtonCancel.Enabled = False&lt;br /&gt;CommentText = "Completed"&lt;br /&gt;ProgressBar.Value = 100&lt;br /&gt;PercentText = "100%"&lt;br /&gt;Repaint&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113117009210615502?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113117009210615502/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113117009210615502' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117009210615502'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113117009210615502'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/xl-display-progress-bar.html' title='XL - Display progress bar'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113116698342480701</id><published>2005-09-12T21:00:00.000-07:00</published><updated>2005-11-04T21:03:03.440-08:00</updated><title type='text'>XL - Specify color through Dialog</title><content type='html'>There is a lot of built-in dialogs in Excel. But as they are designed to be used as part of Excel function, sometimes they are not useful to include its function in VBA. Color index dialog is one of the one. This Sub procedure describes how to make use of it.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub GetColor()&lt;br /&gt;&lt;br /&gt;Dim objPrevCell As Object&lt;br /&gt;Dim lngPrevColor As Long&lt;br /&gt;Dim lngPrevIndex As Long&lt;br /&gt;Dim lngColor As Long&lt;br /&gt;Dim blnResult As Boolean&lt;br /&gt;&lt;br /&gt;Set objPrevCell = ActiveCell&lt;br /&gt;lngPrevIndex = ActiveCell.Interior.ColorIndex&lt;br /&gt;lngPrevColor = IIf(lngPrevIndex &gt; 0, ActiveCell.Interior.Color, xlNone)&lt;br /&gt;blnResult = Application.Dialogs(xlDialogPatterns).Show&lt;br /&gt;&lt;br /&gt;If blnResult = True Then&lt;br /&gt;   With ActiveCell.Interior&lt;br /&gt;   lngColor = .Color&lt;br /&gt;      If lngPrevIndex &gt; 0 Then&lt;br /&gt;         .Color = lngPrevColor&lt;br /&gt;      Else&lt;br /&gt;         .ColorIndex = xlNone&lt;br /&gt;      End If&lt;br /&gt;   End With&lt;br /&gt;   MsgBox lngColor&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113116698342480701?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113116698342480701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113116698342480701' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113116698342480701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113116698342480701'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/xl-specify-color-through-dialog.html' title='XL - Specify color through Dialog'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113116427909871182</id><published>2005-09-11T20:15:00.000-07:00</published><updated>2005-11-04T20:17:59.100-08:00</updated><title type='text'>XL - Save file dialog</title><content type='html'>Same as open file dialog, there is a one for Save. Unlike Open file dialog, of course, multiselect cannot be done.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim strFileName&lt;br /&gt;strFileName = Application.GetSaveAsFilename(InitialFileName:="", _&lt;br /&gt;              FileFilter:="Worksheets,*.xls")&lt;br /&gt;If strFileName = "False" Then MsgBox "No file selected"&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113116427909871182?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113116427909871182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113116427909871182' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113116427909871182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113116427909871182'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/xl-save-file-dialog.html' title='XL - Save file dialog'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113116410097280355</id><published>2005-09-10T20:06:00.000-07:00</published><updated>2005-11-04T20:15:00.993-08:00</updated><title type='text'>XL - Open file dialog</title><content type='html'>In Excel, common open file diaglog can be opened simply with Application.GetOpenFilename method. If cancel button is hit and no file name is selected in the dialog, "False" will be returned. *Actually the return will come as boolean, but in order to handle other strings, has to be checked as string.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub Temp()&lt;br /&gt;Dim strFileName&lt;br /&gt;strFileName = Application.GetOpenFilename(FileFilter:="Worksheets,*.xls", MultiSelect:=False)&lt;br /&gt;If strFileName = "False" Then MsgBox "No file selected"&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113116410097280355?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113116410097280355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113116410097280355' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113116410097280355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113116410097280355'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/xl-open-file-dialog.html' title='XL - Open file dialog'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113116092026461032</id><published>2005-09-09T19:20:00.000-07:00</published><updated>2005-11-04T19:22:14.743-08:00</updated><title type='text'>Windows - Get windows directory</title><content type='html'>With this function, Windows direcotry can be obtained. To use this, simply put the function:&lt;br /&gt;=GetWindowsDir()&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Get Windows directory&lt;br /&gt;Public Declare Function GetWindowsDirectory Lib "kernel32"  Alias "GetWindowsDirectoryA" _&lt;br /&gt; (ByVal lpBuffer As String, ByVal nSize As Long) As Long&lt;br /&gt;&lt;br /&gt;Function GetWindowsDir() As String&lt;br /&gt;Dim strDir As String&lt;br /&gt;Dim lngReturn As Long&lt;br /&gt;strDir = Space(100)&lt;br /&gt;lngReturn = GetWindowsDirectory(strDir, 100)&lt;br /&gt;GetWindowsDir = Mid(strDir, 1, InStr(strDir, Chr(0)) - 1)&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113116092026461032?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113116092026461032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113116092026461032' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113116092026461032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113116092026461032'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/windows-get-windows-directory.html' title='Windows - Get windows directory'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113115979404128625</id><published>2005-09-08T19:00:00.000-07:00</published><updated>2005-11-04T19:03:14.043-08:00</updated><title type='text'>Windows - Get OS version</title><content type='html'>OS version can be checked with the following function. The result will be returned as text string. This can be used in the formula:&lt;br /&gt;=GetVersion()&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Public Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _&lt;br /&gt;  (lpVersionInformation As OSVERSIONINFO) As Long&lt;br /&gt;&lt;br /&gt;Type OSVERSIONINFO&lt;br /&gt;  dwOSVersionInfoSize As Long&lt;br /&gt;  dwMajorVersion As Long&lt;br /&gt;  dwMinorVersion As Long&lt;br /&gt;  dwBuildNumber As Long&lt;br /&gt;  dwPlatformId As Long&lt;br /&gt;  szCSDVersion As String * 128&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Function GetVersion() As String&lt;br /&gt;Dim OSVER As OSVERSIONINFO&lt;br /&gt;Dim strVersion As String&lt;br /&gt;&lt;br /&gt;OSVER.dwOSVersionInfoSize = Len(OSVER)&lt;br /&gt;Call GetVersionEx(OSVER)&lt;br /&gt;&lt;br /&gt;Select Case OSVER.dwPlatformId&lt;br /&gt;  Case 1 'Win32 Windows&lt;br /&gt;    Select Case OSVER.dwMinorVersion&lt;br /&gt;      Case 0&lt;br /&gt;        GetVersion = "Win95"&lt;br /&gt;      Case Else&lt;br /&gt;        GetVersion = "Win98"&lt;br /&gt;    End Select&lt;br /&gt;  Case 2 'Win32 NT&lt;br /&gt;    Select Case OSVER.dwMinorVersion&lt;br /&gt;      Case 0&lt;br /&gt;        GetVersion = "Win2K"&lt;br /&gt;      Case 1&lt;br /&gt;        GetVersion = "WinXP"&lt;br /&gt;      Case 2&lt;br /&gt;        GetVersion = "Win03" 'Sever 2003&lt;br /&gt;    End Select&lt;br /&gt;  Case Else&lt;br /&gt;    GetVersion = "Unknown"&lt;br /&gt;End Select&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113115979404128625?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113115979404128625/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113115979404128625' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113115979404128625'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113115979404128625'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/windows-get-os-version.html' title='Windows - Get OS version'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113115905519720964</id><published>2005-09-07T18:47:00.000-07:00</published><updated>2005-11-04T18:51:06.683-08:00</updated><title type='text'>Windows - Lock computer</title><content type='html'>In order to lock computer, you can do it with the sub procedure below.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Public Declare Function LockWorkStation Lib "User32.dll" ()&lt;br /&gt;&lt;br /&gt;Sub LockComputer()&lt;br /&gt;LockWorkStation&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113115905519720964?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113115905519720964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113115905519720964' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113115905519720964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113115905519720964'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/windows-lock-computer.html' title='Windows - Lock computer'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113115804232472679</id><published>2005-09-06T18:32:00.000-07:00</published><updated>2005-11-04T18:34:02.326-08:00</updated><title type='text'>Windows - Get logon user name</title><content type='html'>The function below helps to obtain the logon user name which the function is running on. This can be used with the formula below:&lt;br /&gt;=GetLogonName()&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _&lt;br /&gt; (ByVal Buffer As String, Size As Long) As Long&lt;br /&gt;&lt;br /&gt;Function GetLogonName() As String&lt;br /&gt;&lt;br /&gt;Dim strUserNameBuff As String * 128&lt;br /&gt;Dim lngReturn As Long&lt;br /&gt;&lt;br /&gt;'Get logon user name&lt;br /&gt;lngReturn = GetUserName(strUserNameBuff, Len(strUserNameBuff))&lt;br /&gt;GetLogonName = Left(strUserNameBuff, InStr(strUserNameBuff, vbNullChar) - 1)&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113115804232472679?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113115804232472679/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113115804232472679' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113115804232472679'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113115804232472679'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/windows-get-logon-user-name.html' title='Windows - Get logon user name'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113115775787174679</id><published>2005-09-05T18:27:00.000-07:00</published><updated>2005-11-04T18:30:43.003-08:00</updated><title type='text'>Windows - Get computer name</title><content type='html'>With this function, you can get computer name which the function is running on. Formula below enabels this:&lt;br /&gt;=GetMachineName()&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Public Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" _&lt;br /&gt; (ByVal Buffer As String, Size As Long) As Long&lt;br /&gt;&lt;br /&gt;'-----&lt;br /&gt;Function GetMachineName() As String&lt;br /&gt;&lt;br /&gt;Dim strComputerNameBuff As String * 16&lt;br /&gt;Dim lngReturn As Long&lt;br /&gt;'Get ComputerName&lt;br /&gt;GetMachineName = ""&lt;br /&gt;lngReturn = GetComputerName(strComputerNameBuff, Len(strComputerNameBuff))&lt;br /&gt;GetMachineName = Left(strComputerNameBuff, _&lt;br /&gt;   InStr(strComputerNameBuff, vbNullChar) - 1)&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113115775787174679?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113115775787174679/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113115775787174679' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113115775787174679'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113115775787174679'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/windows-get-computer-name.html' title='Windows - Get computer name'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113115684284052756</id><published>2005-09-04T18:10:00.000-07:00</published><updated>2005-11-04T18:16:25.040-08:00</updated><title type='text'>FTP - Put file with Wininet API</title><content type='html'>Like getting file via WinInet, with this function, we can put the file to server. The function can be used with the formula below:&lt;br /&gt;=PutFileFtp("server.com", "user", "password", "targetfile", "localfile")&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'--Declaration ------------------------------&lt;br /&gt;'Open FTP connection&lt;br /&gt;Public Declare Function InternetOpen Lib "WinInet.DLL" Alias "InternetOpenA" _&lt;br /&gt; (ByVal lpszAgent As String, ByVal dwAccessType As Long, _&lt;br /&gt;  ByVal lpszProxyName As String, _&lt;br /&gt;  ByVal lpszProxyBypass As String, ByVal dwFlags As Long) As Long&lt;br /&gt;&lt;br /&gt;'Establish FTP connection&lt;br /&gt;Public Declare Function InternetConnect Lib "WinInet.DLL" Alias "InternetConnectA" _&lt;br /&gt; (ByVal hInternetSession As Long, ByVal lpszServerName As String, _&lt;br /&gt;  ByVal nServerPort As Long, ByVal lpszUserName As String, _&lt;br /&gt;  ByVal lpszPassword As String, ByVal dwService As Long, _&lt;br /&gt;  ByVal dwFlags As Long, ByVal dwContext As Long) As Long&lt;br /&gt;&lt;br /&gt;'Close FTP Connection&lt;br /&gt;Public Declare Function InternetCloseHandle Lib "WinInet.DLL" _&lt;br /&gt; (ByVal hInternetSession As Long) As Long&lt;br /&gt;&lt;br /&gt;'PUT file via FTP&lt;br /&gt;Public Declare Function FtpPutFile Lib "WinInet.DLL" Alias "FtpPutFileA" _&lt;br /&gt; (ByVal hFtpSession As Long, ByVal lpszLocalFile As String, _&lt;br /&gt;  ByVal lpszNewRemoteFile As String, ByVal dwFlags As Long, _&lt;br /&gt;  ByVal dwContext As Long) As Long&lt;br /&gt;&lt;br /&gt;Public Const INTERNET_OPEN_TYPE_PRECONFIG As Long = 0&amp;&lt;br /&gt;Public Const INTERNET_DEFAULT_FTP_PORT As Long = 21&amp;&lt;br /&gt;Public Const INTERNET_SERVICE_FTP As Long = 1&amp;&lt;br /&gt;Public Const FTP_TRANSFER_TYPE_ASCII As Long = &amp;H1&amp; 'Ascii&lt;br /&gt;Public Const FTP_TRANSFER_TYPE_BINARY As Long = &amp;H2&amp; 'Binary&lt;br /&gt;&lt;br /&gt;'----------&lt;br /&gt;Public Function PutFileFtp(FtpSvr As String, UserID As String, _&lt;br /&gt;   Password As String, RemoteFile As String, LocalFile As String) As Long&lt;br /&gt;Dim iHandle As Long&lt;br /&gt;Dim iFTP As Long&lt;br /&gt;Dim lngRet As Long&lt;br /&gt;Dim ErrText As String&lt;br /&gt;PutFileFtp = vbOK&lt;br /&gt;'Connection open&lt;br /&gt;iHandle = InternetOpen(vbNullString, _&lt;br /&gt;                      INTERNET_OPEN_TYPE_PRECONFIG, _&lt;br /&gt;                      vbNullString, _&lt;br /&gt;                      vbNullString, _&lt;br /&gt;                      0&amp;)&lt;br /&gt;If iHandle = 0 Then PutFileFtp = vbCancel: Exit Function  'Error&lt;br /&gt;'Connect to server&lt;br /&gt;iFTP = InternetConnect(iHandle, _&lt;br /&gt;                       FtpSvr, _&lt;br /&gt;                       INTERNET_DEFAULT_FTP_PORT, _&lt;br /&gt;                       UserID, _&lt;br /&gt;                       Password, _&lt;br /&gt;                       INTERNET_SERVICE_FTP, _&lt;br /&gt;                       0&amp;, _&lt;br /&gt;                       0&amp;)&lt;br /&gt;If iFTP = 0 Then PutFileFtp = vbCancel: Exit Function 'Error&lt;br /&gt;'Put file to server. Can switch Ascii/Binary by changing the parameter below.&lt;br /&gt;lngRet = FtpPutFile(iFTP, _&lt;br /&gt;                    LocalFile &amp; vbNullChar, _&lt;br /&gt;                    RemoteFile &amp; vbNullChar, _&lt;br /&gt;                    FTP_TRANSFER_TYPE_ASCII, _&lt;br /&gt;                    0&amp;)&lt;br /&gt;If lngRet = 0 Then PutFileFtp = vbCancel: Exit Function 'Error&lt;br /&gt;lngRet = InternetCloseHandle(iFTP)&lt;br /&gt;lngRet = InternetCloseHandle(iHandle)&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113115684284052756?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113115684284052756/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113115684284052756' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113115684284052756'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113115684284052756'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/ftp-put-file-with-wininet-api.html' title='FTP - Put file with Wininet API'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113115636328652684</id><published>2005-09-03T18:00:00.000-07:00</published><updated>2005-11-04T18:10:00.726-08:00</updated><title type='text'>FTP - Get file with Wininet API</title><content type='html'>This function enables to do FTP from client. This uses the Wininet API functions. You can use this with the formula like:&lt;br /&gt;=GetFileFtp("temp.server.com","userId","password","targetfile","localfile")&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'--Declaration--------&lt;br /&gt;'Open FTP connection&lt;br /&gt;Public Declare Function InternetOpen Lib "WinInet.DLL" Alias "InternetOpenA" _&lt;br /&gt; (ByVal lpszAgent As String, ByVal dwAccessType As Long, _&lt;br /&gt;  ByVal lpszProxyName As String, _&lt;br /&gt;  ByVal lpszProxyBypass As String, ByVal dwFlags As Long) As Long&lt;br /&gt;&lt;br /&gt;'Establish FTP connection&lt;br /&gt;Public Declare Function InternetConnect Lib "WinInet.DLL" Alias "InternetConnectA" _&lt;br /&gt; (ByVal hInternetSession As Long, ByVal lpszServerName As String, _&lt;br /&gt;  ByVal nServerPort As Long, ByVal lpszUserName As String, _&lt;br /&gt;  ByVal lpszPassword As String, ByVal dwService As Long, _&lt;br /&gt;  ByVal dwFlags As Long, ByVal dwContext As Long) As Long&lt;br /&gt;&lt;br /&gt;'Close FTP Connection&lt;br /&gt;Public Declare Function InternetCloseHandle Lib "WinInet.DLL" _&lt;br /&gt; (ByVal hInternetSession As Long) As Long&lt;br /&gt;&lt;br /&gt;'GET file via FTP&lt;br /&gt;Public Declare Function FtpGetFile Lib "WinInet.DLL" Alias "FtpGetFileA" _&lt;br /&gt;  (ByVal hFtpSession As Long, ByVal lpszRemoteFile As String, _&lt;br /&gt;   ByVal lpszNewFile As String, ByVal fFailIfExists As Long, _&lt;br /&gt;   ByVal dwLocalFlagsAndAttributes As Long, ByVal dwInternetFlags As Long, _&lt;br /&gt;   ByVal dwContext As Long) As Long&lt;br /&gt;&lt;br /&gt;Public Const INTERNET_OPEN_TYPE_PRECONFIG As Long = 0&amp;&lt;br /&gt;Public Const INTERNET_DEFAULT_FTP_PORT As Long = 21&amp;&lt;br /&gt;Public Const INTERNET_SERVICE_FTP As Long = 1&amp;&lt;br /&gt;Public Const FTP_TRANSFER_TYPE_ASCII As Long = &amp;H1&amp;  'Ascii mode&lt;br /&gt;Public Const FTP_TRANSFER_TYPE_BINARY As Long = &amp;H2&amp; 'Binary mode&lt;br /&gt;&lt;br /&gt;'--------&lt;br /&gt;Function GetFileFtp(strFtpSvr As String, strUserID As String, _&lt;br /&gt;  strPassword As String, strRemoteFile As String, strLocalFile As String) As Long&lt;br /&gt;Dim hInternet As Long&lt;br /&gt;Dim hFTP As Long&lt;br /&gt;Dim lngRet As Long&lt;br /&gt;Dim strErrText As String&lt;br /&gt;&lt;br /&gt;GetFileFtp = vbOK&lt;br /&gt;'Open connection&lt;br /&gt;hInternet = InternetOpen(vbNullString, _&lt;br /&gt;                         INTERNET_OPEN_TYPE_PRECONFIG, _&lt;br /&gt;                         vbNullString, _&lt;br /&gt;                         vbNullString, _&lt;br /&gt;                         0&amp;)&lt;br /&gt;If hInternet = 0 Then GetFileFtp = vbCancel: Exit Function 'Error occurred&lt;br /&gt;'Connect to server&lt;br /&gt;hFTP = InternetConnect(hInternet, _&lt;br /&gt;                         strFtpSvr, _&lt;br /&gt;                         INTERNET_DEFAULT_FTP_PORT, _&lt;br /&gt;                         strUserID, _&lt;br /&gt;                         strPassword, _&lt;br /&gt;                         INTERNET_SERVICE_FTP, _&lt;br /&gt;                         0&amp;, _&lt;br /&gt;                         0&amp;)&lt;br /&gt;If hFTP = 0 Then GetFileFtp = vbCancel: Exit Function 'Error occurred&lt;br /&gt;'Finally get file. Switch ASCII, BINARY by chnaging the constant&lt;br /&gt;lngRet = FtpGetFile(hFTP, _&lt;br /&gt;                         strRemoteFile &amp; vbNullChar, _&lt;br /&gt;                         strLocalFile &amp; vbNullChar, _&lt;br /&gt;                         1&amp;, _&lt;br /&gt;                         0&amp;, _&lt;br /&gt;                         FTP_TRANSFER_TYPE_ASCII, _  &lt;br /&gt;                         0&amp;)&lt;br /&gt;lngRet = InternetCloseHandle(hFTP)&lt;br /&gt;lngRet = InternetCloseHandle(hInternet)&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113115636328652684?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113115636328652684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113115636328652684' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113115636328652684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113115636328652684'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/ftp-get-file-with-wininet-api.html' title='FTP - Get file with Wininet API'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113111596095139462</id><published>2005-09-02T06:49:00.000-07:00</published><updated>2005-11-04T06:52:40.953-08:00</updated><title type='text'>ADO - Stream write file</title><content type='html'>This sub procedure will write what is specified in strContents as text file. Example of this is:&lt;br /&gt;Call WriteHtml("c:\temp\temp.html", "Hello World", "UTF-8")&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub WriteHtml(strFileName As String, strContents As String, strCharSet As String)&lt;br /&gt;&lt;br /&gt;Dim oStream As Object&lt;br /&gt;&lt;br /&gt;Set oStream = CreateObject("ADODB.Stream")&lt;br /&gt;oStream.Open&lt;br /&gt;oStream.Type = 2&lt;br /&gt;oStream.Charset = strCharSet&lt;br /&gt;oStream.WriteText strContents&lt;br /&gt;oStream.SaveToFile FileName:=strFileName, Options:=2&lt;br /&gt;&lt;br /&gt;oStream.Close&lt;br /&gt;       &lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113111596095139462?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113111596095139462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113111596095139462' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113111596095139462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113111596095139462'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/ado-stream-write-file.html' title='ADO - Stream write file'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113111651616919235</id><published>2005-09-01T06:59:00.000-07:00</published><updated>2005-11-04T07:03:05.716-08:00</updated><title type='text'>ADO - Stream read HTML on URL</title><content type='html'>The function for reading file can be used even for the file on the net. This can be done as like:&lt;br /&gt;=GetFile("http://sapass.metro.client.jp", "UTF-8")&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Function GetFile(strFile As String, strCharSet As String) As String&lt;br /&gt;...&lt;br /&gt;See "Stream read file" content.&lt;br /&gt;...&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113111651616919235?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113111651616919235/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113111651616919235' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113111651616919235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113111651616919235'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/ado-stream-read-html-on-url.html' title='ADO - Stream read HTML on URL'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113111573070651754</id><published>2005-09-01T06:45:00.000-07:00</published><updated>2005-11-04T06:59:13.246-08:00</updated><title type='text'>ADO - Stream read file</title><content type='html'>This function will read file and return the string as a result. This can be used as like:&lt;br /&gt;=GetFile("c:\temp\temp.txt", "UTF-8")&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Function GetFile(strFile As String, strCharSet As String) As String&lt;br /&gt;&lt;br /&gt;Dim oStream As Object&lt;br /&gt; &lt;br /&gt;Set oStream = CreateObject("ADODB.Stream")&lt;br /&gt;oStream.Open&lt;br /&gt;oStream.Type = 2&lt;br /&gt;oStream.flush&lt;br /&gt;oStream.Charset = strCharSet&lt;br /&gt;oStream.LoadFromFile FileName:=strFile&lt;br /&gt;GetFile = oStream.ReadText&lt;br /&gt;oStream.Close&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113111573070651754?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113111573070651754/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113111573070651754' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113111573070651754'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113111573070651754'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/09/ado-stream-read-file.html' title='ADO - Stream read file'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113119856782722624</id><published>2005-08-30T05:47:00.000-07:00</published><updated>2005-11-05T05:49:27.846-08:00</updated><title type='text'>Registry - Delete registry key</title><content type='html'>This function helps to remove reigstry key. For deletion, it uses function in Shlwapi.dll.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Open registry handle&lt;br /&gt;Public Declare Function RegOpenKeyEx Lib "ADVAPI32" Alias "RegOpenKeyExA" _&lt;br /&gt; (ByVal hKey&amp;, ByVal lpSubKey$, ByVal ulOptions&amp;, ByVal samDesired&amp;, _&lt;br /&gt;  phkResult&amp;) As Long&lt;br /&gt;'Close registry handle&lt;br /&gt;Public Declare Function RegCloseKey Lib "ADVAPI32" (ByVal hKey&amp;) As Long&lt;br /&gt;'Delete key&lt;br /&gt;Private Declare Function SHDeleteKey Lib "Shlwapi" Alias "SHDeleteKeyA" _&lt;br /&gt; (ByVal hKey As Long, ByVal lpSubKey As String) As Long&lt;br /&gt;&lt;br /&gt;Public Const HKEY_CURRENT_USER = &amp;H80000001&lt;br /&gt;Public Const HKEY_LOCAL_MACHINE = &amp;H80000002&lt;br /&gt;Public Const KEY_QUERY_VALUE           As Long = &amp;H1&lt;br /&gt;Public Const KEY_ENUMERATE_SUB_KEYS    As Long = &amp;H8&lt;br /&gt;Public Const KEY_NOTIFY                As Long = &amp;H10&lt;br /&gt;Public Const KEY_CREATE_SUB_KEY        As Long = &amp;H4&lt;br /&gt;Public Const KEY_CREATE_LINK           As Long = &amp;H20&lt;br /&gt;Public Const KEY_SET_VALUE             As Long = &amp;H2&lt;br /&gt;Public Const KEY_ALL_ACCESS            As Long = KEY_QUERY_VALUE Or _&lt;br /&gt;                                                 KEY_ENUMERATE_SUB_KEYS Or _&lt;br /&gt;                                                 KEY_NOTIFY Or _&lt;br /&gt;                                                 KEY_CREATE_SUB_KEY Or _&lt;br /&gt;                                                 KEY_CREATE_LINK Or _&lt;br /&gt;                                                 KEY_SET_VALUE&lt;br /&gt;&lt;br /&gt;   &lt;br /&gt;Public Function DeleteKey(iKey As String, iSection As String, Optional iRoot _&lt;br /&gt;  As String) As Long&lt;br /&gt;Dim lngReturn As Long&lt;br /&gt;Dim strReturn As Long&lt;br /&gt;iRoot = IIf(iRoot = "", HKEY_CURRENT_USER, iRoot)&lt;br /&gt;lngReturn = RegOpenKeyEx(iRoot, iKey, 0, KEY_ALL_ACCESS, strReturn)&lt;br /&gt;lngReturn = SHDeleteKey(strReturn, iSection)&lt;br /&gt;Call RegCloseKey(strReturn)&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113119856782722624?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113119856782722624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113119856782722624' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113119856782722624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113119856782722624'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/08/registry-delete-registry-key.html' title='Registry - Delete registry key'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113101495131943551</id><published>2005-08-29T02:44:00.000-07:00</published><updated>2005-11-03T03:53:52.606-08:00</updated><title type='text'>Registry - Set registry value</title><content type='html'>On the contrary to get values from registry, here we try to set value on registry. In the code below, if there is no key yet exists, this function will create it for you. You can use this function in Excel with formula below:&lt;br /&gt;=SetRegKey("temp","temp","temp")&lt;br /&gt;&lt;br /&gt;You can check the result by RegEdit.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Create registry key&lt;br /&gt;Public Declare Function RegCreateKeyEx Lib "ADVAPI32.dll" Alias "RegCreateKeyExA" _&lt;br /&gt; (ByVal hKey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, _&lt;br /&gt;  ByVal lpClass As String, ByVal dwOptions As Long, _&lt;br /&gt;  ByVal samDesired As Long, lpSecurityAttributes As Long, _&lt;br /&gt;  phkResult As Long, lpdwDisposition As Long) As Long&lt;br /&gt;&lt;br /&gt;'Set registry value&lt;br /&gt;Public Declare Function RegSetValueEx Lib "ADVAPI32.dll" Alias "RegSetValueExA" _&lt;br /&gt; (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, _&lt;br /&gt;  ByVal dwType As Long, ByVal lpData As Any, ByVal cbData As Long) As Long&lt;br /&gt;&lt;br /&gt;'Close registry handle&lt;br /&gt;Public Declare Function RegCloseKey Lib "ADVAPI32" (ByVal hKey&amp;) As Long&lt;br /&gt;    &lt;br /&gt;Public Const HKEY_CURRENT_USER = &amp;H80000001&lt;br /&gt;Public Const HKEY_LOCAL_MACHINE = &amp;H80000002&lt;br /&gt;Public Const KEY_QUERY_VALUE           As Long = &amp;H1&lt;br /&gt;Public Const KEY_ENUMERATE_SUB_KEYS    As Long = &amp;H8&lt;br /&gt;Public Const KEY_NOTIFY                As Long = &amp;H10&lt;br /&gt;Public Const KEY_CREATE_SUB_KEY        As Long = &amp;H4&lt;br /&gt;Public Const KEY_CREATE_LINK           As Long = &amp;H20&lt;br /&gt;Public Const KEY_SET_VALUE             As Long = &amp;H2&lt;br /&gt;Public Const KEY_ALL_ACCESS            As Long = KEY_QUERY_VALUE Or _&lt;br /&gt;                                                 KEY_ENUMERATE_SUB_KEYS Or _&lt;br /&gt;                                                 KEY_NOTIFY Or _&lt;br /&gt;                                                 KEY_CREATE_SUB_KEY Or _&lt;br /&gt;                                                 KEY_CREATE_LINK Or _&lt;br /&gt;                                                 KEY_SET_VALUE&lt;br /&gt;&lt;br /&gt;Public Function SetRegKey(iKey As String, iName As String, iValue As String, _&lt;br /&gt;       Optional iRoot As String) As Long&lt;br /&gt;&lt;br /&gt;'Update registry key&lt;br /&gt;Dim lngReturn, lngResult, lngAttr As Long&lt;br /&gt;&lt;br /&gt;SetRegKey = 0&lt;br /&gt;'Open registry key&lt;br /&gt;lngAttr = 0&lt;br /&gt;iRoot = IIf(iRoot = "", HKEY_CURRENT_USER, iRoot)&lt;br /&gt;lngResult = RegCreateKeyEx(iRoot, iKey, 0, vbNullString, 0, KEY_ALL_ACCESS, _&lt;br /&gt;            lngAttr, lngReturn, Len(iValue))&lt;br /&gt;lngResult = RegSetValueEx(lngReturn, iName, 0, 1, iValue, Len(iValue))&lt;br /&gt;'Close registry key&lt;br /&gt;Call RegCloseKey(lngReturn)&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113101495131943551?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113101495131943551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113101495131943551' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113101495131943551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113101495131943551'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/08/registry-set-registry-value.html' title='Registry - Set registry value'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113101447137516603</id><published>2005-08-28T02:33:00.000-07:00</published><updated>2005-11-03T02:41:11.386-08:00</updated><title type='text'>Registry - Get registry value</title><content type='html'>In this code, obtain registry value for the specified key information. This utilizes the APIs in ADVAPI32 libraly.&lt;br /&gt;&lt;br /&gt;In Excel, You can use this in formula below:&lt;br /&gt;=GetRegValue("Control Panel\Desktop","ConvertedWallpaper")&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Open registry handle&lt;br /&gt;Public Declare Function RegOpenKeyEx Lib "ADVAPI32" Alias "RegOpenKeyExA" _&lt;br /&gt; (ByVal hKey&amp;, ByVal lpSubKey$, ByVal ulOptions&amp;, ByVal samDesired&amp;, phkResult&amp;) As Long&lt;br /&gt;&lt;br /&gt;'Close registry handle&lt;br /&gt;Public Declare Function RegCloseKey Lib "ADVAPI32" (ByVal hKey&amp;) As Long&lt;br /&gt;&lt;br /&gt;'Get registry value&lt;br /&gt;Public Declare Function RegQueryValueExstr Lib "ADVAPI32" Alias "RegQueryValueExA" _&lt;br /&gt; (ByVal hKey&amp;, ByVal lpValueName$, ByVal lpReserved&amp;, ByVal lpType&amp;, ByVal lpData$, _&lt;br /&gt; lpcbData&amp;) As Long&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;Public Const HKEY_CURRENT_USER = &amp;H80000001&lt;br /&gt;Public Const HKEY_LOCAL_MACHINE = &amp;H80000002&lt;br /&gt;Public Const KEY_QUERY_VALUE           As Long = &amp;H1&lt;br /&gt;Public Const KEY_ENUMERATE_SUB_KEYS    As Long = &amp;H8&lt;br /&gt;Public Const KEY_NOTIFY                As Long = &amp;H10&lt;br /&gt;Public Const KEY_CREATE_SUB_KEY        As Long = &amp;H4&lt;br /&gt;Public Const KEY_CREATE_LINK           As Long = &amp;H20&lt;br /&gt;Public Const KEY_SET_VALUE             As Long = &amp;H2&lt;br /&gt;Public Const KEY_ALL_ACCESS            As Long = KEY_QUERY_VALUE Or _&lt;br /&gt;                                                 KEY_ENUMERATE_SUB_KEYS Or _&lt;br /&gt;                                                 KEY_NOTIFY Or _&lt;br /&gt;                                                 KEY_CREATE_SUB_KEY Or _&lt;br /&gt;                                                 KEY_CREATE_LINK Or _&lt;br /&gt;                                                 KEY_SET_VALUE&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Function GetRegValue(iKey As String, iSection As String, Optional iRoot As String) As String&lt;br /&gt;'Get System information from registry&lt;br /&gt;Dim lngResult, lngBuffer As Long&lt;br /&gt;Dim strReturn, strBuffer As String&lt;br /&gt;&lt;br /&gt;iRoot = IIf(iRoot = "", HKEY_CURRENT_USER, iRoot)&lt;br /&gt;'Open registry key&lt;br /&gt;GetRegValue = ""&lt;br /&gt;lngResult = RegOpenKeyEx(iRoot, iKey, 0, KEY_QUERY_VALUE, strReturn)&lt;br /&gt;If lngResult = 0 Then&lt;br /&gt;   strBuffer = String(255, Chr(0))&lt;br /&gt;   lngResult = RegQueryValueExstr(strReturn, iSection, 0, 0, strBuffer, 255)&lt;br /&gt;   If lngResult = 0 Then&lt;br /&gt;      GetRegValue = Left(strBuffer, InStr(strBuffer, Chr(0)) - 1)&lt;br /&gt;   End If&lt;br /&gt;End If&lt;br /&gt;'Close Registry key&lt;br /&gt;Call RegCloseKey(strReturn)&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113101447137516603?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113101447137516603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113101447137516603' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113101447137516603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113101447137516603'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/08/registry-get-registry-value.html' title='Registry - Get registry value'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113115288515159687</id><published>2005-08-27T17:04:00.000-07:00</published><updated>2005-11-04T17:09:01.620-08:00</updated><title type='text'>Ini File - Write .ini file</title><content type='html'>To write and update .ini file, we can do it with the code below. This can be used with the formula below.&lt;br /&gt;=WritePrivateProfileString("temp","temp","1","c:\temp\temp.ini")&lt;br /&gt;&lt;br /&gt;Then the c:\temp\tmep.ini file will have content:&lt;br /&gt;[temp]&lt;br /&gt;temp=1&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Declare API&lt;br /&gt;Public Declare Function WritePrivateProfileStringA Lib "kernel32" _&lt;br /&gt;    (ByVal section As String, ByVal entry As String, _&lt;br /&gt;     ByVal buf As String, ByVal ininm As String) As Long&lt;br /&gt;&lt;br /&gt;Function WritePrivateProfileString(iSection As String, _&lt;br /&gt;     iEntry As String, iValue As String, iFileName As String) As Long&lt;br /&gt;WritePrivateProfileString = _&lt;br /&gt;     WritePrivateProfileStringA(iSection, iEntry, iValue, iFileName)&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113115288515159687?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113115288515159687/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113115288515159687' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113115288515159687'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113115288515159687'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/08/ini-file-write-ini-file.html' title='Ini File - Write .ini file'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113099006123179805</id><published>2005-08-26T19:53:00.000-07:00</published><updated>2005-11-11T16:41:10.870-08:00</updated><title type='text'>Ini file - Get sections</title><content type='html'>This function will get all section name defined in the specified ini file.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Public Declare Function GetPrivateProfileSectionNames Lib "Kernel32" _&lt;br /&gt;  Alias "GetPrivateProfileSectionNamesA" _&lt;br /&gt; (ByVal lpszReturnBuffer As String, ByVal nSize As Long, ByVal lpFileName As String) As Long&lt;br /&gt;&lt;br /&gt;Function GetSections(iFile As String) As String&lt;br /&gt;Dim strBuffer As String * 1024&lt;br /&gt;Dim lngBuffer As Long&lt;br /&gt;Dim lngResult As Long&lt;br /&gt;Dim lngIndex As Long&lt;br /&gt;Dim varSections() As String&lt;br /&gt;&lt;br /&gt;'strBuffer = Space(1024)&lt;br /&gt;GetSections = ""&lt;br /&gt;lngBuffer = GetPrivateProfileSectionNames(strBuffer, Len(strBuffer), iFile)&lt;br /&gt;varSections = Split(Left(strBuffer, lngBuffer - 1), vbNullChar)&lt;br /&gt;For lngIndex = 0 To UBound(varSections)&lt;br /&gt;   GetSections = GetSections &amp; varSections(lngIndex) &amp; ";"&lt;br /&gt;Next&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113099006123179805?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113099006123179805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113099006123179805' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113099006123179805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113099006123179805'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/08/ini-file-get-sections.html' title='Ini file - Get sections'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113098304980247692</id><published>2005-08-25T17:54:00.000-07:00</published><updated>2005-11-02T18:01:12.066-08:00</updated><title type='text'>Ini file - Get Ini file value</title><content type='html'>This function reads .ini file specified in the parameter and get the value. The format of the function is:&lt;br /&gt;  &lt;br /&gt;  =GetIniValue("Mail","CMCDLLNAME","c:\windows\win.ini")&lt;br /&gt;&lt;br /&gt;Then, you may be able to obatin value "mapi.dll".&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Public Declare Function GetPrivateProfileString Lib "kernel32" _&lt;br /&gt;  Alias "GetPrivateProfileStringA" _&lt;br /&gt; (ByVal lpApplicationName As String, ByVal lpKeyName As Any, _&lt;br /&gt;  ByVal lpDefault As String, ByVal lpReturnedString As String, _&lt;br /&gt;  ByVal nSize As Long, ByVal lpFileName As String) As Long&lt;br /&gt;&lt;br /&gt;Function GetIniValue(iSection As String, iKey As String, iFile As String) As String&lt;br /&gt;&lt;br /&gt;Dim strBuffer As String * 96&lt;br /&gt;Dim lngResult As Long&lt;br /&gt;strBuffer = Space(96)&lt;br /&gt;GetIniValue = ""&lt;br /&gt;lngResult = GetPrivateProfileString(iSection, iKey, "", strBuffer, Len(strBuffer), iFile)&lt;br /&gt;If Trim(Left(strBuffer, InStr(strBuffer, Chr(0)) - 1)) &lt;&gt; "" Then&lt;br /&gt;   GetIniValue = Trim(Left(strBuffer, InStr(strBuffer, Chr(0)) - 1))&lt;br /&gt;End If&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113098304980247692?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113098304980247692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113098304980247692' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113098304980247692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113098304980247692'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/08/ini-file-get-ini-file-value.html' title='Ini file - Get Ini file value'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113098128436226313</id><published>2005-08-24T17:25:00.000-07:00</published><updated>2005-11-02T17:28:17.280-08:00</updated><title type='text'>FSO - Write text file</title><content type='html'>This sample shows how to write text string into text file by FSO. This uses "WriteLine" method and write text string as line. If do not need to put CR, can use "Write" method instead.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub WriteToFile()&lt;br /&gt;&lt;br /&gt;Dim objFso, objFile As Object&lt;br /&gt;Dim varRange As Variant&lt;br /&gt;Dim strPath As String&lt;br /&gt;Dim lngRow As Long&lt;br /&gt;&lt;br /&gt;Const FOR_READ = 1, FOR_WRITE = 2&lt;br /&gt;&lt;br /&gt;strPath = Application.GetSaveAsFilename("*.txt")&lt;br /&gt;If strPath = "False" Then Exit Sub&lt;br /&gt;&lt;br /&gt;Set objFso = CreateObject("Scripting.FileSystemObject")&lt;br /&gt;Set objFile = objFso.OpenTextFile(strPath, FOR_WRITE, True)&lt;br /&gt;&lt;br /&gt;For Each varRange In ActiveSheet.UsedRange.Rows&lt;br /&gt;   objFile.WriteLine (varRange.Value)&lt;br /&gt;Next&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113098128436226313?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113098128436226313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113098128436226313' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113098128436226313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113098128436226313'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/08/fso-write-text-file.html' title='FSO - Write text file'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113093791243043268</id><published>2005-08-23T05:24:00.000-07:00</published><updated>2005-11-02T05:27:24.193-08:00</updated><title type='text'>FSO - Check existence of specified folder</title><content type='html'>By this function, you can check the existence of the specified folder.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'This function checks for the existence of the folder&lt;br /&gt;Function FolderExists(iDir As String) As Boolean 'iDir can be e.g. "c:\temp"&lt;br /&gt;'Declare variable&lt;br /&gt;Dim objFso As Object&lt;br /&gt;'Create FSO object&lt;br /&gt;Set objFso = CreateObject("Scripting.FileSystemObject")&lt;br /&gt;'Returns the check result&lt;br /&gt;FolderExists = objFso.FolderExists(iDir)&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113093791243043268?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113093791243043268/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113093791243043268' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113093791243043268'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113093791243043268'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/08/fso-check-existence-of-specified.html' title='FSO - Check existence of specified folder'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113093774224304859</id><published>2005-08-22T05:20:00.000-07:00</published><updated>2005-11-02T05:28:24.666-08:00</updated><title type='text'>FSO - Check existence of the specified file</title><content type='html'>This is a function which checks the existence of the specified file.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Function to check file existence (iPath can be e.g. "c:\temp\temp.txt")&lt;br /&gt;Function FileExists(iPath As String) As Boolean&lt;br /&gt;'Declare variable&lt;br /&gt;Dim objFso As Object&lt;br /&gt;'Create FSO object&lt;br /&gt;Set objFso = CreateObject("Scripting.FileSystemObject")&lt;br /&gt;'Then return the result&lt;br /&gt;FileExists = objFso.FileExists(iPath)&lt;br /&gt;End Function&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113093774224304859?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113093774224304859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113093774224304859' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113093774224304859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113093774224304859'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/08/fso-check-existence-of-specified-file.html' title='FSO - Check existence of the specified file'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113093658549726704</id><published>2005-08-21T04:30:00.000-07:00</published><updated>2005-11-02T05:03:05.513-08:00</updated><title type='text'>FSO - Read text file</title><content type='html'>In this sub procedure, read text stream from the specified file path and copy the contents to the Active Excel worksheet. (will overwrite the contents).&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;'Read text file from file and copy contents to Excel sheet&lt;br /&gt;Sub ReadFile()&lt;br /&gt;'Define variables&lt;br /&gt;Dim objFso, objFile As Object&lt;br /&gt;Dim objFile As Object&lt;br /&gt;Dim strPath As String&lt;br /&gt;Dim lngRow As Long&lt;br /&gt;'Define constant&lt;br /&gt;Const FOR_READ = 1&lt;br /&gt;Const FOR_WRITE = 2&lt;br /&gt;'Ask file path&lt;br /&gt;strPath = InputBox("Specify File Path") 'e.g. c:\temp\temp.txt&lt;br /&gt;'Create FSO text stream&lt;br /&gt;Set objFso = CreateObject("Scripting.FileSystemObject")&lt;br /&gt;Set objFile = objFso.OpenTextFile(strPath, FOR_READ)&lt;br /&gt;'Initialize row of sheet&lt;br /&gt;lngRow = 1&lt;br /&gt;'Read file until it ends then put the contents to sheet&lt;br /&gt;Do Until objFile.AtEndOfStream&lt;br /&gt;   ActiveSheet.Cells(lngRow, 1).Value = objFile.ReadLine&lt;br /&gt;   lngRow = lngRow + 1&lt;br /&gt;Loop&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113093658549726704?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113093658549726704/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113093658549726704' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113093658549726704'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113093658549726704'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/08/fso-read-text-file.html' title='FSO - Read text file'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-15508355.post-113093533202872973</id><published>2005-08-20T04:30:00.000-07:00</published><updated>2005-11-02T05:10:42.890-08:00</updated><title type='text'>FSO - List up files in the specified folder</title><content type='html'>Here in this code, we check how to obtain the files in the specified folder. This reads the file information in the specified foler then copy the information to the active worksheet. (Note: this will overwrite the contents of the sheet.)&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Sub ListUpFiles()&lt;br /&gt;'Declare variables&lt;br /&gt;Dim objFso, objFolder As Object&lt;br /&gt;Dim varFile As Variant&lt;br /&gt;Dim strDir As String&lt;br /&gt;Dim lngRow As Long&lt;br /&gt;'Ask directory to check&lt;br /&gt;strDir = InputBox("Specify directory") 'e.g. c:\temp&lt;br /&gt;'Create FSO and folder object&lt;br /&gt;Set objFso = CreateObject("Scripting.FileSystemObject")&lt;br /&gt;Set objFolder = objFso.GetFolder(strDir)&lt;br /&gt;'Initialize row counter&lt;br /&gt;lngRow = 1&lt;br /&gt;'Loop file in the folder&lt;br /&gt;For Each varFile In objFolder.Files&lt;br /&gt;   'Copy the information&lt;br /&gt;   ActiveSheet.Cells(lngRow, 1).Value = varFile.Name&lt;br /&gt;   ActiveSheet.Cells(lngRow, 2).Value = varFile.DateCreated&lt;br /&gt;   ActiveSheet.Cells(lngRow, 3).Value = varFile.DateLastAccessed&lt;br /&gt;   ActiveSheet.Cells(lngRow, 4).Value = varFile.DateLastModified&lt;br /&gt;   ActiveSheet.Cells(lngRow, 5).Value = varFile.Size&lt;br /&gt;   ActiveSheet.Cells(lngRow, 6).Value = varFile.Type&lt;br /&gt;   lngRow = lngRow + 1&lt;br /&gt;Next&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/15508355-113093533202872973?l=sapass.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sapass.blogspot.com/feeds/113093533202872973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=15508355&amp;postID=113093533202872973' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113093533202872973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/15508355/posts/default/113093533202872973'/><link rel='alternate' type='text/html' href='http://sapass.blogspot.com/2005/08/fso-list-up-files-in-specified-folder.html' title='FSO - List up files in the specified folder'/><author><name>sapass</name><uri>http://www.blogger.com/profile/14143321813992516747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
