<?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'><id>tag:blogger.com,1999:blog-3509162107510152399</id><updated>2009-11-05T09:42:08.220-08:00</updated><title type='text'>VB Tutor..</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default?start-index=26&amp;max-results=25'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>84</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-5079385418014998547</id><published>2009-10-12T08:01:00.000-07:00</published><updated>2009-10-12T08:07:06.282-07:00</updated><title type='text'>Creating Runtime Data Reports</title><content type='html'>&lt;a style="font-family: courier new; font-weight: bold;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_7yyVsGPueko/StNFOIqEJII/AAAAAAAAAWU/w6-gaCmVBuQ/s1600-h/vb2.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 236px;" src="http://2.bp.blogspot.com/_7yyVsGPueko/StNFOIqEJII/AAAAAAAAAWU/w6-gaCmVBuQ/s320/vb2.jpg" alt="" id="BLOGGER_PHOTO_ID_5391729288037016706" border="0" /&gt;&lt;/a&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Private Sub Combo1_Click()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;If Combo1.Text = "OBC" Then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;DataReport1.Show&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ElseIf Combo1.Text = "SC" Then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;DataReport2.Show&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;DataReport3.Show&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;End If&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;End Sub&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-5079385418014998547?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/5079385418014998547/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=5079385418014998547' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/5079385418014998547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/5079385418014998547'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/10/creating-runtime-data-reports.html' title='Creating Runtime Data Reports'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_7yyVsGPueko/StNFOIqEJII/AAAAAAAAAWU/w6-gaCmVBuQ/s72-c/vb2.jpg' height='72' width='72'/><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-8494194541843898295</id><published>2009-10-12T07:11:00.000-07:00</published><updated>2009-10-12T07:16:00.099-07:00</updated><title type='text'>User Control ,Creating OCX File in VB, Adding OCX to Components .</title><content type='html'>&lt;span style="font-family: courier new; font-weight: bold;"&gt;Dim a, b&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Dim sy&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Private Sub cmdequal_Click()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;b = Val(Text1.Text)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Text1.Text = Empty&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;If sy = "+" Then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Text1.Text = a + b&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ElseIf sy = "-" Then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Text1.Text = a - b&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;ElseIf sy = "*" Then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Text1.Text = a * b&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Text1.Text = a / b&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;End If&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;End Sub&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Private Sub cmdnums_Click(Index As Integer)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Text1.Text = Text1.Text &amp;amp; cmdnums(Index).Caption&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;End Sub&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Private Sub cmdop_Click(Index As Integer)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;a = Val(Text1.Text)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;sy = cmdop(Index).Caption&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;Text1.Text = Empty&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new; font-weight: bold;"&gt;End Sub&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-8494194541843898295?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/8494194541843898295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=8494194541843898295' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/8494194541843898295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/8494194541843898295'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/10/user-control-creating-ocx-file-in-vb.html' title='User Control ,Creating OCX File in VB, Adding OCX to Components .'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-2060675117715882548</id><published>2009-07-12T10:24:00.000-07:00</published><updated>2009-07-12T10:27:27.689-07:00</updated><title type='text'>Adodc.Recordset Connectivity</title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 14"&gt;&lt;meta name="Originator" content="Microsoft Word 14"&gt;&lt;link style="font-family: verdana;" rel="File-List" href="file:///C:%5CUsers%5Cpop%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;o:officedocumentsettings&gt;   &lt;o:targetscreensize&gt;800x600&lt;/o:TargetScreenSize&gt;  &lt;/o:OfficeDocumentSettings&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;link style="font-family: verdana;" rel="themeData" href="file:///C:%5CUsers%5Cpop%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"&gt;&lt;link style="font-family: verdana;" rel="colorSchemeMapping" href="file:///C:%5CUsers%5Cpop%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;X-NONE&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:enableopentypekerning/&gt;    &lt;w:dontflipmirrorindents/&gt;    &lt;w:overridetablestylehps/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="&amp;#45;-"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="0" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:1; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:variable; 	mso-font-signature:0 0 0 0 0 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman","serif"; 	mso-fareast-font-family:"Times New Roman";} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	font-size:10.0pt; 	mso-ansi-font-size:10.0pt; 	mso-bidi-font-size:10.0pt;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman","serif";} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;Private Sub add_Click()&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;Adodc1.Recordset.AddNew&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;End Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;Private Sub delete_Click()&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;Adodc1.Recordset.delete&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;End Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;Private Sub last_Click()&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;Adodc1.Recordset.MoveLast&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;End Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;Private Sub modify_Click()&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;Adodc1.Recordset.EditMode&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;End Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;Private Sub next_Click()&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;Adodc1.Recordset.MoveNext&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;End Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;Private Sub previous_Click()&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;Adodc1.Recordset.MovePrevious&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;End Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;Private Sub save_Click()&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;Adodc1.Recordset.save&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-right: -0.25in; font-family: verdana;"&gt;End Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-2060675117715882548?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/2060675117715882548/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=2060675117715882548' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/2060675117715882548'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/2060675117715882548'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/07/adodcrecordset-connectivity.html' title='Adodc.Recordset Connectivity'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-5903659023242796056</id><published>2009-02-07T04:10:00.000-08:00</published><updated>2009-02-07T04:16:47.186-08:00</updated><title type='text'>List in memory</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: courier new;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;struct node&lt;br /&gt;{&lt;br /&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;  int x;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;  struct node *next;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;};&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;int main()&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;{&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    /* This won't change, or we would lose the list in memory */&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    struct node *root;       &lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    /* This will point to each node as it traverses the list */&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    struct node *conductor;  &lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    root = malloc( sizeof(struct node) );  &lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    root-&gt;next = 0;   &lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    root-&gt;x = 12;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    conductor = root; &lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    if ( conductor != 0 ) {&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;        while ( conductor-&gt;next != 0)&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;        {&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;            conductor = conductor-&gt;next;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;        }&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    }&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    /* Creates a node at the end of the list */&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    conductor-&gt;next = malloc( sizeof(struct node) );  &lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    conductor = conductor-&gt;next; &lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    if ( conductor == 0 )&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    {&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;        printf( "Out of memory" );&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;        return 0;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    }&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    /* initialize the new memory */&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    conductor-&gt;next = 0;         &lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    conductor-&gt;x = 42;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;    return 0;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;}&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;br /&gt;&lt;stdio.h style="font-family: courier new;"&gt;&lt;stdlib.h&gt;&lt;/stdlib.h&gt;&lt;/stdio.h&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-5903659023242796056?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/5903659023242796056/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=5903659023242796056' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/5903659023242796056'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/5903659023242796056'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/list-in-memory.html' title='List in memory'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-3604864571032276465</id><published>2009-02-04T06:47:00.000-08:00</published><updated>2009-02-04T06:50:12.770-08:00</updated><title type='text'>Show the 'File Open' Common Dialog via API calls</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;To display a file open common dialog use the following routine (an example routine can be found at the bottom of this post):&lt;br /&gt;&lt;br /&gt;Option Explicit&lt;br /&gt;&lt;br /&gt;Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OpenFileName) As Long&lt;br /&gt;&lt;br /&gt;Private Type OpenFileName&lt;br /&gt;    lStructSize As Long&lt;br /&gt;    hwndOwner As Long&lt;br /&gt;    hInstance As Long&lt;br /&gt;    lpstrFilter As String&lt;br /&gt;    lpstrCustomFilter As String&lt;br /&gt;    nMaxCustFilter As Long&lt;br /&gt;    nFilterIndex As Long&lt;br /&gt;    lpstrFile As String&lt;br /&gt;    nMaxFile As Long&lt;br /&gt;    lpstrFileTitle As String&lt;br /&gt;    nMaxFileTitle As Long&lt;br /&gt;    lpstrInitialDir As String&lt;br /&gt;    lpstrTitle As String&lt;br /&gt;    flags As Long&lt;br /&gt;    nFileOffset As Integer&lt;br /&gt;    nFileExtension As Integer&lt;br /&gt;    lpstrDefExt As String&lt;br /&gt;    lCustData As Long&lt;br /&gt;    lpfnHook As Long&lt;br /&gt;    lpTemplateName As String&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;'Purpose     :  Allows the user to select a file name from a local or network directory.&lt;br /&gt;'Inputs      :  sInitDir            The initial directory of the file dialog.&lt;br /&gt;'               sFileFilters        A file filter string, with the following format:&lt;br /&gt;'                                   eg. "Excel Files;*.xls|Text Files;*.txt|Word Files;*.doc"&lt;br /&gt;'               [sTitle]            The dialog title&lt;br /&gt;'               [lParentHwnd]       The handle to the parent dialog that is calling this function.&lt;br /&gt;'Outputs     :  Returns the selected path and file name or a zero length string if the user pressed cancel&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Function BrowseForFile(sInitDir As String, Optional ByVal sFileFilters As String, Optional sTitle As String = "Open File", Optional lParentHwnd As Long) As String&lt;br /&gt;    Dim tFileBrowse As OpenFileName&lt;br /&gt;    Const clMaxLen As Long = 254&lt;br /&gt;   &lt;br /&gt;    tFileBrowse.lStructSize = Len(tFileBrowse)&lt;br /&gt;   &lt;br /&gt;    'Replace friendly deliminators with nulls&lt;br /&gt;    sFileFilters = Replace(sFileFilters, "|", vbNullChar)&lt;br /&gt;    sFileFilters = Replace(sFileFilters, ";", vbNullChar)&lt;br /&gt;    If Right$(sFileFilters, 1) &lt;&gt; vbNullChar Then&lt;br /&gt;        'Add final delimiter&lt;br /&gt;        sFileFilters = sFileFilters &amp;amp; vbNullChar&lt;br /&gt;    End If&lt;br /&gt;   &lt;br /&gt;    'Select a filter&lt;br /&gt;    tFileBrowse.lpstrFilter = sFileFilters &amp;amp; "All Files (*.*)" &amp;amp; vbNullChar &amp;amp; "*.*" &amp;amp; vbNullChar&lt;br /&gt;    'create a buffer for the file&lt;br /&gt;    tFileBrowse.lpstrFile = String(clMaxLen, " ")&lt;br /&gt;    'set the maximum length of a returned file&lt;br /&gt;    tFileBrowse.nMaxFile = clMaxLen + 1&lt;br /&gt;    'Create a buffer for the file title&lt;br /&gt;    tFileBrowse.lpstrFileTitle = Space$(clMaxLen)&lt;br /&gt;    'Set the maximum length of a returned file title&lt;br /&gt;    tFileBrowse.nMaxFileTitle = clMaxLen + 1&lt;br /&gt;    'Set the initial directory&lt;br /&gt;    tFileBrowse.lpstrInitialDir = sInitDir&lt;br /&gt;    'Set the parent handle&lt;br /&gt;    tFileBrowse.hwndOwner = lParentHwnd&lt;br /&gt;    'Set the title&lt;br /&gt;    tFileBrowse.lpstrTitle = sTitle&lt;br /&gt;   &lt;br /&gt;    'No flags&lt;br /&gt;    tFileBrowse.flags = 0&lt;br /&gt;&lt;br /&gt;    'Show the dialog&lt;br /&gt;    If GetOpenFileName(tFileBrowse) Then&lt;br /&gt;        BrowseForFile = Trim$(tFileBrowse.lpstrFile)&lt;br /&gt;        If Right$(BrowseForFile, 1) = vbNullChar Then&lt;br /&gt;            'Remove trailing null&lt;br /&gt;            BrowseForFile = Left$(BrowseForFile, Len(BrowseForFile) - 1)&lt;br /&gt;        End If&lt;br /&gt;    End If&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;Sub Test()&lt;br /&gt;    BrowseForFile "c:\", "Excel File (*.xls);*.xls", "Open Workbook"&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-3604864571032276465?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/3604864571032276465/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=3604864571032276465' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/3604864571032276465'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/3604864571032276465'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/show-file-open-common-dialog-via-api.html' title='Show the &apos;File Open&apos; Common Dialog via API calls'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-1439080136582148775</id><published>2009-02-04T06:46:00.000-08:00</published><updated>2009-02-04T06:47:03.283-08:00</updated><title type='text'>Show the 'Choose a Color' Common Dialog</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;Option Explicit&lt;br /&gt;Private Declare Function ChooseColorA Lib "comdlg32.dll" (pChoosecolor As tChooseColor) As Long&lt;br /&gt;Private Declare Function GetActiveWindow Lib "user32" () As Long&lt;br /&gt;&lt;br /&gt;Private Type tChooseColor&lt;br /&gt;    lStructSize As Long&lt;br /&gt;    hwndOwner As Long&lt;br /&gt;    hInstance As Long&lt;br /&gt;    rgbResult As Long&lt;br /&gt;    lpCustColors As String&lt;br /&gt;    flags As Long&lt;br /&gt;    lCustData As Long&lt;br /&gt;    lpfnHook As Long&lt;br /&gt;    lpTemplateName As String&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;'Purpose     :  Shows the Choose Color Dialog&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;'Inputs      :  N/A&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;'Outputs     :  Returns -1 if the user pressed cancel, else returns the selected color&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Function ShowColor() As Long&lt;br /&gt;    Dim tColor As tChooseColor&lt;br /&gt;    Dim Custcolor(16) As Long&lt;br /&gt;    Dim lReturn As Long, lThisColor As Long&lt;br /&gt;    Dim abytCustomColors(0 To 16 * 4 - 1) As Byte&lt;br /&gt;   &lt;br /&gt;    For lThisColor = LBound(abytCustomColors) To UBound(abytCustomColors)&lt;br /&gt;        abytCustomColors(lThisColor) = 0&lt;br /&gt;    Next&lt;br /&gt;&lt;br /&gt;    tColor.lStructSize = Len(tColor)&lt;br /&gt;    tColor.hwndOwner = GetActiveWindow        'or Me.hwnd in VB&lt;br /&gt;    tColor.hInstance = 1       'or App.hInstance in VB&lt;br /&gt;    'Convert the custom colors to Unicode&lt;br /&gt;    tColor.lpCustColors = StrConv(abytCustomColors, vbUnicode)&lt;br /&gt;    tColor.flags = 0&lt;br /&gt;&lt;br /&gt;    'Show the dialog&lt;br /&gt;    If ChooseColorA(tColor) &lt;&gt; 0 Then&lt;br /&gt;        ShowColor = tColor.rgbResult&lt;br /&gt;    Else&lt;br /&gt;        ShowColor = -1&lt;br /&gt;    End If&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-1439080136582148775?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/1439080136582148775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=1439080136582148775' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/1439080136582148775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/1439080136582148775'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/show-choose-color-common-dialog.html' title='Show the &apos;Choose a Color&apos; Common Dialog'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-4874525247299320718</id><published>2009-02-04T06:45:00.002-08:00</published><updated>2009-02-04T06:46:09.658-08:00</updated><title type='text'>Displaying The Windows Colour Dialog</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;'Declare various Types, ENums and Functions.&lt;br /&gt;Private Type udtCHOOSECOLOR&lt;br /&gt;    lStructSize As Long&lt;br /&gt;    hWndOwner As Long&lt;br /&gt;    hInstance As Long&lt;br /&gt;    rgbResult As Long&lt;br /&gt;    lpCustColors As Long&lt;br /&gt;    Flags As Long&lt;br /&gt;    lCustData As Long&lt;br /&gt;    lpfnHook As Long&lt;br /&gt;    lpTemplateName As String&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Public Enum ColorDialogFlags&lt;br /&gt;    UseInitialColor = &amp;amp;H1&lt;br /&gt;    ShowCustomColorsOnLoad = &amp;amp;H2&lt;br /&gt;    DisableCustomColors = &amp;amp;H4&lt;br /&gt;    ShowHelp = &amp;amp;H8&lt;br /&gt;    OnlySolidColors = &amp;amp;H80&lt;br /&gt;    AllowAnyColor = &amp;amp;H100&lt;br /&gt;    Default = &amp;amp;H1 Or &amp;amp;H100&lt;br /&gt;End Enum&lt;br /&gt;&lt;br /&gt;Private CDColor As udtCHOOSECOLOR&lt;br /&gt;&lt;br /&gt;Private Declare Function ChooseColor Lib "comdlg32.dll" _&lt;br /&gt; Alias "ChooseColorA" (pChoosecolor As udtCHOOSECOLOR) As Long&lt;br /&gt;Private Declare Function CommDlgExtendedError Lib "comdlg32.dll" () As Long&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Public Function GetColor(ByVal T_hWnd As Long, ByVal Flags As ColorDialogFlags, _&lt;br /&gt; Optional ByVal InitialColor As Long) As Long&lt;br /&gt;    'Dimension a variable.&lt;br /&gt;    Dim CustColors(0 To 15) As Long&lt;br /&gt;   &lt;br /&gt;    'Set up the colour configuration.&lt;br /&gt;    For I = 0 To 15&lt;br /&gt;        CustColors(I) = vbWhite&lt;br /&gt;    Next&lt;br /&gt;    CDColor.Flags = Flags&lt;br /&gt;    CDColor.hWndOwner = T_hWnd&lt;br /&gt;    CDColor.hInstance = App.hInstance&lt;br /&gt;    CDColor.lpCustColors = VarPtr(CustColors(0))&lt;br /&gt;    CDColor.lStructSize = Len(CDColor)&lt;br /&gt;    CDColor.rgbResult = InitialColor&lt;br /&gt;    lngResult = ChooseColor(CDColor)&lt;br /&gt;   &lt;br /&gt;    'Get the colour that is selected.&lt;br /&gt;    If lngResult = 1 And CommDlgExtendedError = 0 Then&lt;br /&gt;        GetColor = CDColor.rgbResult&lt;br /&gt;    Else&lt;br /&gt;        GetColor = -1&lt;br /&gt;    End If&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-4874525247299320718?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/4874525247299320718/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=4874525247299320718' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/4874525247299320718'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/4874525247299320718'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/displaying-windows-colour-dialog.html' title='Displaying The Windows Colour Dialog'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-2579628276762212045</id><published>2009-02-04T06:45:00.001-08:00</published><updated>2009-02-04T06:45:37.327-08:00</updated><title type='text'>Displaying The Search For Directory Dialog</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;Private Declare Function SHBrowseForFolder _&lt;br /&gt; Lib "shell32" (lpbi As BrowseInfo) As Long&lt;br /&gt;&lt;br /&gt;Private Declare Function SHGetPathFromIDList _&lt;br /&gt; Lib "shell32" (ByVal pidList As Long, _&lt;br /&gt; ByVal lpBuffer As String) As Long&lt;br /&gt;&lt;br /&gt;Private Declare Function lstrcat Lib "kernel32" _&lt;br /&gt; Alias "lstrcatA" (ByVal lpString1 As String, ByVal _&lt;br /&gt; lpString2 As String) As Long&lt;br /&gt;&lt;br /&gt;Private Const BIF_RETURNONLYFSDIRS = 1&lt;br /&gt;Private Const BIF_DONTGOBELOWDOMAIN = 2&lt;br /&gt;Private Const MAX_PATH = 260&lt;br /&gt;&lt;br /&gt;Private Type BrowseInfo&lt;br /&gt;    hWndOwner As Long&lt;br /&gt;    pIDLRoot As Long&lt;br /&gt;    pszDisplayName As Long&lt;br /&gt;    lpszTitle As Long&lt;br /&gt;    ulFlags As Long&lt;br /&gt;    lpfnCallback As Long&lt;br /&gt;    lParam As Long&lt;br /&gt;    iImage As Long&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;'Wrapper Function.&lt;br /&gt;Private Sub DirBox(Msg As String, Directory As String)&lt;br /&gt;&lt;br /&gt;    'Dimension some variables.&lt;br /&gt;    Dim lpIDList As Long&lt;br /&gt;    Dim sBuffer As String&lt;br /&gt;    Dim szTitle As String&lt;br /&gt;    Dim tBrowseInfo As BrowseInfo&lt;br /&gt;   &lt;br /&gt;    'Set the message displayed on the dialog.&lt;br /&gt;    szTitle = Msg&lt;br /&gt;   &lt;br /&gt;    'Set up the Type.&lt;br /&gt;    With tBrowseInfo&lt;br /&gt;       .hWndOwner = Me.hWnd&lt;br /&gt;       .lpszTitle = lstrcat(szTitle, "")&lt;br /&gt;       .ulFlags = BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN&lt;br /&gt;    End With&lt;br /&gt;   &lt;br /&gt;    'Show the dialog box.&lt;br /&gt;    lpIDList = SHBrowseForFolder(tBrowseInfo)&lt;br /&gt;&lt;br /&gt;    'Process the data returned.&lt;br /&gt;    If (lpIDList) Then&lt;br /&gt;       sBuffer = Space(MAX_PATH)&lt;br /&gt;       SHGetPathFromIDList lpIDList, sBuffer&lt;br /&gt;       sBuffer = Left(sBuffer, InStr(sBuffer, vbNullChar) - 1)&lt;br /&gt;       Directory = sBuffer&lt;br /&gt;    End If&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-2579628276762212045?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/2579628276762212045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=2579628276762212045' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/2579628276762212045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/2579628276762212045'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/displaying-search-for-directory-dialog.html' title='Displaying The Search For Directory Dialog'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-943521399880002765</id><published>2009-02-04T06:43:00.001-08:00</published><updated>2009-02-04T06:43:50.741-08:00</updated><title type='text'>Displaying The Common Save Dialog</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;'The API Function.&lt;br /&gt;Public Declare Function GetSaveFileName Lib "comdlg32.dll" _&lt;br /&gt; Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As Long&lt;br /&gt;&lt;br /&gt;'Now come some Types.&lt;br /&gt;Public Enum GFNFlags&lt;br /&gt;    OFN_ALLOWMULTISELECT = &amp;amp;H200&lt;br /&gt;    OFN_CREATEPROMPT = &amp;amp;H2000&lt;br /&gt;    OFN_EXPLORER = &amp;amp;H80000&lt;br /&gt;    OFN_FILEMUSTEXIST = &amp;amp;H1000&lt;br /&gt;    OFN_HIDEREADONLY = &amp;amp;H4&lt;br /&gt;    OFN_LONGNAMES = &amp;amp;H200000&lt;br /&gt;    OFN_NOCHANGEDIR = &amp;amp;H8&lt;br /&gt;    OFN_NODEREFERENCELINKS = &amp;amp;H100000&lt;br /&gt;    OFN_NOLONGNAMES = &amp;amp;H40000&lt;br /&gt;    OFN_NONETWORKBUTTON = &amp;amp;H20000&lt;br /&gt;    OFN_NOREADONLYRETURN = &amp;amp;H8000&lt;br /&gt;    OFN_NOTESTFILECREATE = &amp;amp;H10000&lt;br /&gt;    OFN_NOVALIDATE = &amp;amp;H100&lt;br /&gt;    OFN_OVERWRITEPROMPT = &amp;amp;H2&lt;br /&gt;    OFN_PATHMUSTEXIST = &amp;amp;H800&lt;br /&gt;    OFN_READONLY = &amp;amp;H1&lt;br /&gt;End Enum&lt;br /&gt;&lt;br /&gt;Type OPENFILENAME&lt;br /&gt;   lStructSize As Long&lt;br /&gt;   hwndOwner As Long&lt;br /&gt;   hInstance As Long&lt;br /&gt;   lpstrFilter As String&lt;br /&gt;   lpstrCustomFilter As String&lt;br /&gt;   nMaxCustFilter As Long&lt;br /&gt;   nFilterIndex As Long&lt;br /&gt;   lpstrFile As String&lt;br /&gt;   nMaxFile As Long&lt;br /&gt;   lpstrFileTitle As String&lt;br /&gt;   nMaxFileTitle As Long&lt;br /&gt;   lpstrInitialDir As String&lt;br /&gt;   lpstrTitle As String&lt;br /&gt;   Flags As Long&lt;br /&gt;   nFileOffset As Integer&lt;br /&gt;   nFileExtension As Integer&lt;br /&gt;   lpstrDefExt As String&lt;br /&gt;   lCustData As Long&lt;br /&gt;   lpfnHook As Long&lt;br /&gt;   lpTemplateName As String&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;'This is the wrapper Function.&lt;br /&gt;Public Function SaveDialog(ByVal OwnerhWnd As Long, _&lt;br /&gt; ByVal Filters As String, ByVal FilterIndex As Long, _&lt;br /&gt; ByVal FNameLength As Long, _&lt;br /&gt; Optional ByVal InitFolder As String = "", _&lt;br /&gt; Optional ByVal InitFileName As String = "", _&lt;br /&gt; Optional ByVal dlgTitle As String = "", _&lt;br /&gt; Optional ByVal Flags As GFNFlags = 0) As String&lt;br /&gt;    'Dimension some variables.&lt;br /&gt;    Dim GFN As OPENFILENAME&lt;br /&gt;   &lt;br /&gt;    'Sort out some of the Type we will pass.&lt;br /&gt;    GFN.lStructSize = Len(GFN)&lt;br /&gt;    GFN.hwndOwner = OwnerhWnd&lt;br /&gt;    GFN.hInstance = App.hInstance&lt;br /&gt;   &lt;br /&gt;    'Sort out the filters.&lt;br /&gt;    For I = 1 To Len(Filters)&lt;br /&gt;        If Mid$(Filters, I, 1) = "|" Then&lt;br /&gt;            Filters = Left$(Filters, I - 1) &amp;amp; Chr$(0) &amp;amp; _&lt;br /&gt;             Right$(Filters, Len(Filters) - I)&lt;br /&gt;        End If&lt;br /&gt;    Next&lt;br /&gt;   &lt;br /&gt;    'Finish setting up the Type.&lt;br /&gt;    GFN.lpstrFilter = Filters&lt;br /&gt;    GFN.nFilterIndex = FilterIndex&lt;br /&gt;    GFN.lpstrFile = InitFileName &amp;amp; String$(FNameLength - Len(InitFileName), Chr$(0))&lt;br /&gt;    GFN.nMaxFile = FNameLength&lt;br /&gt;    GFN.lpstrFileTitle = String$(FNameLength, Chr$(0))&lt;br /&gt;    GFN.nMaxFileTitle = FNameLength&lt;br /&gt;    GFN.lpstrInitialDir = InitFolder&lt;br /&gt;    GFN.lpstrTitle = dlgTitle&lt;br /&gt;    GFN.Flags = Flags&lt;br /&gt;   &lt;br /&gt;    'Get and return the filename.&lt;br /&gt;    If GetSaveFileName(GFN) &gt;= 1 Then&lt;br /&gt;        SaveDialog = GFN.lpstrFile&lt;br /&gt;    Else&lt;br /&gt;        SaveDialog = Chr$(0)&lt;br /&gt;    End If&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-943521399880002765?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/943521399880002765/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=943521399880002765' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/943521399880002765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/943521399880002765'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/displaying-common-save-dialog.html' title='Displaying The Common Save Dialog'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-6689290686844666941</id><published>2009-02-04T06:37:00.000-08:00</published><updated>2009-02-04T06:41:36.430-08:00</updated><title type='text'></title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;'The API Function.&lt;br /&gt;Public Declare Function GetOpenFileName Lib "comdlg32.dll" _&lt;br /&gt; Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long&lt;br /&gt;&lt;br /&gt;'Now come some Types.&lt;br /&gt;Public Enum GFNFlags&lt;br /&gt;    OFN_ALLOWMULTISELECT = &amp;amp;H200&lt;br /&gt;    OFN_CREATEPROMPT = &amp;amp;H2000&lt;br /&gt;    OFN_EXPLORER = &amp;amp;H80000&lt;br /&gt;    OFN_FILEMUSTEXIST = &amp;amp;H1000&lt;br /&gt;    OFN_HIDEREADONLY = &amp;amp;H4&lt;br /&gt;    OFN_LONGNAMES = &amp;amp;H200000&lt;br /&gt;    OFN_NOCHANGEDIR = &amp;amp;H8&lt;br /&gt;    OFN_NODEREFERENCELINKS = &amp;amp;H100000&lt;br /&gt;    OFN_NOLONGNAMES = &amp;amp;H40000&lt;br /&gt;    OFN_NONETWORKBUTTON = &amp;amp;H20000&lt;br /&gt;    OFN_NOREADONLYRETURN = &amp;amp;H8000&lt;br /&gt;    OFN_NOTESTFILECREATE = &amp;amp;H10000&lt;br /&gt;    OFN_NOVALIDATE = &amp;amp;H100&lt;br /&gt;    OFN_OVERWRITEPROMPT = &amp;amp;H2&lt;br /&gt;    OFN_PATHMUSTEXIST = &amp;amp;H800&lt;br /&gt;    OFN_READONLY = &amp;amp;H1&lt;br /&gt;End Enum&lt;br /&gt;&lt;br /&gt;Type OPENFILENAME&lt;br /&gt;   lStructSize As Long&lt;br /&gt;   hwndOwner As Long&lt;br /&gt;   hInstance As Long&lt;br /&gt;   lpstrFilter As String&lt;br /&gt;   lpstrCustomFilter As String&lt;br /&gt;   nMaxCustFilter As Long&lt;br /&gt;   nFilterIndex As Long&lt;br /&gt;   lpstrFile As String&lt;br /&gt;   nMaxFile As Long&lt;br /&gt;   lpstrFileTitle As String&lt;br /&gt;   nMaxFileTitle As Long&lt;br /&gt;   lpstrInitialDir As String&lt;br /&gt;   lpstrTitle As String&lt;br /&gt;   Flags As Long&lt;br /&gt;   nFileOffset As Integer&lt;br /&gt;   nFileExtension As Integer&lt;br /&gt;   lpstrDefExt As String&lt;br /&gt;   lCustData As Long&lt;br /&gt;   lpfnHook As Long&lt;br /&gt;   lpTemplateName As String&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;'This is the wrapper Function.&lt;br /&gt;Public Function OpenDialog(ByVal OwnerhWnd As Long, _&lt;br /&gt; ByVal Filters As String, ByVal FilterIndex As Long, _&lt;br /&gt; ByVal FNameLength As Long, _&lt;br /&gt; Optional ByVal InitFolder As String = "", _&lt;br /&gt; Optional ByVal InitFileName As String = "", _&lt;br /&gt; Optional ByVal dlgTitle As String = "", _&lt;br /&gt; Optional ByVal Flags As GFNFlags = 0) As String&lt;br /&gt;    'Dimension some variables.&lt;br /&gt;    Dim GFN As OPENFILENAME&lt;br /&gt;   &lt;br /&gt;    'Sort out some of the Type we will pass.&lt;br /&gt;    GFN.lStructSize = Len(GFN)&lt;br /&gt;    GFN.hwndOwner = OwnerhWnd&lt;br /&gt;    GFN.hInstance = App.hInstance&lt;br /&gt;   &lt;br /&gt;    'Sort out the filters.&lt;br /&gt;    For I = 1 To Len(Filters)&lt;br /&gt;        If Mid$(Filters, I, 1) = "|" Then&lt;br /&gt;            Filters = Left$(Filters, I - 1) &amp;amp; Chr$(0) &amp;amp; _&lt;br /&gt;             Right$(Filters, Len(Filters) - I)&lt;br /&gt;        End If&lt;br /&gt;    Next&lt;br /&gt;   &lt;br /&gt;    'Finish setting up the Type.&lt;br /&gt;    GFN.lpstrFilter = Filters&lt;br /&gt;    GFN.nFilterIndex = FilterIndex&lt;br /&gt;    GFN.lpstrFile = InitFileName &amp;amp; String$(FNameLength - Len(InitFileName), Chr$(0))&lt;br /&gt;    GFN.nMaxFile = FNameLength&lt;br /&gt;    GFN.lpstrFileTitle = String$(FNameLength, Chr$(0))&lt;br /&gt;    GFN.nMaxFileTitle = FNameLength&lt;br /&gt;    GFN.lpstrInitialDir = InitFolder&lt;br /&gt;    GFN.lpstrTitle = dlgTitle&lt;br /&gt;    GFN.Flags = Flags&lt;br /&gt;   &lt;br /&gt;    'Get and return the filename.&lt;br /&gt;    If GetOpenFileName(GFN) &gt;= 1 Then&lt;br /&gt;        OpenDialog = GFN.lpstrFile&lt;br /&gt;    Else&lt;br /&gt;        OpenDialog = Chr$(0)&lt;br /&gt;    End If&lt;br /&gt;&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-6689290686844666941?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/6689290686844666941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=6689290686844666941' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/6689290686844666941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/6689290686844666941'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/1-then-opendialog-gfn.html' title=''/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-1116438027885850316</id><published>2009-02-04T02:46:00.000-08:00</published><updated>2009-02-04T02:50:23.176-08:00</updated><title type='text'>Send the text in a range to a word document</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;'Purpose     :  Sends the text in a range to a word application&lt;br /&gt;'Inputs      :  rngSelection                The range to send to a word document&lt;br /&gt;'Outputs     :  Returns True on success.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Function WordSendRangeTo(rngSelection As Object, Optional sSaveToFile As String, Optional bShowWord As Boolean = False) As Boolean&lt;br /&gt;   Dim oWordApp As Object          'Early bound type = Word.Application&lt;br /&gt;   Dim oNewDoc As Object           'Early bound type = Word.Document&lt;br /&gt;   Dim oWordRange As Object        'Early bound type = Word.Range&lt;br /&gt;   Dim avVaules As Variant, vCell As Variant, sText As String&lt;br /&gt;&lt;br /&gt;   On Error GoTo ErrFailed&lt;br /&gt;   'Build up text to send to word document&lt;br /&gt;   avVaules = rngSelection.Value&lt;br /&gt;   For Each vCell In avVaules&lt;br /&gt;       sText = sText &amp;amp; vCell &amp;amp; " "&lt;br /&gt;   Next&lt;br /&gt;   sText = Trim$(sText)&lt;br /&gt;&lt;br /&gt;   'Create word objects&lt;br /&gt;   Set oWordApp = CreateObject("Word.Application")&lt;br /&gt;   Set oNewDoc = oWordApp.Documents.Add&lt;br /&gt;   Set oWordRange = oNewDoc.Words(1)&lt;br /&gt;&lt;br /&gt;   'Send text to word document&lt;br /&gt;   With oWordRange&lt;br /&gt;       .Text = sText&lt;br /&gt;       On Error Resume Next&lt;br /&gt;       Set .Font = rngSelection.Font&lt;br /&gt;   End With&lt;br /&gt;   On Error GoTo ErrFailed&lt;br /&gt;&lt;br /&gt;   'Save Document&lt;br /&gt;   If Len(sSaveToFile) Then&lt;br /&gt;       oNewDoc.SaveAs sSaveToFile&lt;br /&gt;   End If&lt;br /&gt;&lt;br /&gt;   If bShowWord Then&lt;br /&gt;       'Show Word&lt;br /&gt;       oWordApp.Visible = True&lt;br /&gt;       oWordApp.WindowState = 1    'wdWindowStateMaximize&lt;br /&gt;   Else&lt;br /&gt;       'Quit word&lt;br /&gt;       oWordApp.Quit&lt;br /&gt;   End If&lt;br /&gt;&lt;br /&gt;   WordSendRangeTo = True&lt;br /&gt;   GoTo ExitSub&lt;br /&gt;&lt;br /&gt;ErrFailed:&lt;br /&gt;   'Error occurred&lt;br /&gt;   WordSendRangeTo = False&lt;br /&gt;&lt;br /&gt;ExitSub:&lt;br /&gt;   'De-reference objects&lt;br /&gt;   Set oWordApp = Nothing&lt;br /&gt;   Set oNewDoc = Nothing&lt;br /&gt;   Set oWordRange = Nothing&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;'Demonstration routine&lt;br /&gt;Sub Test()&lt;br /&gt;   WordSendRangeTo Selection, "C:\test.doc"&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;                        &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-1116438027885850316?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/1116438027885850316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=1116438027885850316' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/1116438027885850316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/1116438027885850316'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/send-text-in-range-to-word-document.html' title='Send the text in a range to a word document'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-1750599343470427082</id><published>2009-02-04T02:45:00.000-08:00</published><updated>2009-02-04T02:46:39.192-08:00</updated><title type='text'>Start, Stop and Pause NT Services</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: courier new;"&gt;Option Explicit&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Public Enum eServiceState&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    essStopService&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    essStartService&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    essPauseService&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;End Enum&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Declare Function CloseServiceHandle Lib "advapi32.dll" (ByVal hSCObject As Long) As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Declare Function ControlService Lib "advapi32.dll" (ByVal lHwndService As Long, ByVal dwControl As Long, lpServiceStatus As SERVICE_STATUS) As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Declare Function OpenSCManager Lib "advapi32.dll" Alias "OpenSCManagerA" (ByVal lpMachineName As String, ByVal lpDatabaseName As String, ByVal dwDesiredAccess As Long) As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Declare Function OpenService Lib "advapi32.dll" Alias "OpenServiceA" (ByVal hSCManager As Long, ByVal lpServiceName As String, ByVal dwDesiredAccess As Long) As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Declare Function QueryServiceStatus Lib "advapi32.dll" (ByVal lHwndService As Long, lpServiceStatus As SERVICE_STATUS) As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Declare Function StartService Lib "advapi32.dll" Alias "StartServiceA" (ByVal lHwndService As Long, ByVal dwNumServiceArgs As Long, ByVal lpServiceArgVectors As Long) As Long&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICES_ACTIVE_DATABASE = "ServicesActive"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_CONTROL_STOP = &amp;amp;H1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_CONTROL_PAUSE = &amp;amp;H2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_STOPPED = &amp;amp;H1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_START_PENDING = &amp;amp;H2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_STOP_PENDING = &amp;amp;H3&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_RUNNING = &amp;amp;H4&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_CONTINUE_PENDING = &amp;amp;H5&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_PAUSE_PENDING = &amp;amp;H6&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_PAUSED = &amp;amp;H7&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const STANDARD_RIGHTS_REQUIRED = &amp;amp;HF0000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SC_MANAGER_CONNECT = &amp;amp;H1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SC_MANAGER_CREATE_SERVICE = &amp;amp;H2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SC_MANAGER_ENUMERATE_SERVICE = &amp;amp;H4&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SC_MANAGER_LOCK = &amp;amp;H8&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SC_MANAGER_QUERY_LOCK_STATUS = &amp;amp;H10&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SC_MANAGER_MODIFY_BOOT_CONFIG = &amp;amp;H20&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SC_MANAGER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SC_MANAGER_CONNECT Or SC_MANAGER_CREATE_SERVICE Or SC_MANAGER_ENUMERATE_SERVICE Or SC_MANAGER_LOCK Or SC_MANAGER_QUERY_LOCK_STATUS Or SC_MANAGER_MODIFY_BOOT_CONFIG)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_QUERY_CONFIG = &amp;amp;H1&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_CHANGE_CONFIG = &amp;amp;H2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_QUERY_STATUS = &amp;amp;H4&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_ENUMERATE_DEPENDENTS = &amp;amp;H8&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_START = &amp;amp;H10&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_STOP = &amp;amp;H20&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_PAUSE_CONTINUE = &amp;amp;H40&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_INTERROGATE = &amp;amp;H80&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_USER_DEFINED_CONTROL = &amp;amp;H100&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Const SERVICE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SERVICE_QUERY_CONFIG Or SERVICE_CHANGE_CONFIG Or SERVICE_QUERY_STATUS Or SERVICE_ENUMERATE_DEPENDENTS Or SERVICE_START Or SERVICE_STOP Or SERVICE_PAUSE_CONTINUE Or SERVICE_INTERROGATE Or SERVICE_USER_DEFINED_CONTROL)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Private Type SERVICE_STATUS&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    dwServiceType As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    dwCurrentState As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    dwControlsAccepted As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    dwWin32ExitCode As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    dwServiceSpecificExitCode As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    dwCheckPoint As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    dwWaitHint As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;End Type&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;'Purpose     :  Returns the status of a NT Service&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;'Inputs      :  sServiceName                The name of the service to test&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;'               [sComputerName]             The name of the machine to test the service status on.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;'                                           If unspecified uses the local machine&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;'Outputs     :  Returns a English description of the service status&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Public Function ServiceStatus(sServiceName As String, Optional sComputerName As String) As String&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Dim tServiceStat As SERVICE_STATUS&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Dim lHwndSManager As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Dim lHwndService As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Dim hServiceStatus As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    'Check the input data&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    If InStr(1, sServiceName, " ") Then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        Debug.Print "Service names cannot contain spaces. Use the 'Service Name' of the service, not the 'Display Name'"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        Exit Function&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    End If&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    ServiceStatus = ""&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    'Open the service manager&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    lHwndSManager = OpenSCManager(sComputerName, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    If lHwndSManager &lt;&gt; 0 Then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        'Open the service&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        lHwndService = OpenService(lHwndSManager, sServiceName, SERVICE_ALL_ACCESS)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        If lHwndService &lt;&gt; 0 Then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            'Query the service&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            hServiceStatus = QueryServiceStatus(lHwndService, tServiceStat)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            If hServiceStatus &lt;&gt; 0 Then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                Select Case tServiceStat.dwCurrentState&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                Case SERVICE_STOPPED&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                    ServiceStatus = "Stopped"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                Case SERVICE_START_PENDING&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                    ServiceStatus = "Start Pending"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                Case SERVICE_STOP_PENDING&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                    ServiceStatus = "Stop Pending"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                Case SERVICE_RUNNING&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                    ServiceStatus = "Running"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                Case SERVICE_CONTINUE_PENDING&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                    ServiceStatus = "Coninue Pending"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                Case SERVICE_PAUSE_PENDING&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                    ServiceStatus = "Pause Pending"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                Case SERVICE_PAUSED&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                    ServiceStatus = "Paused"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                End Select&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            End If&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            'Close the service&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            CloseServiceHandle lHwndService&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        End If&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        'Close the service mananger&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        CloseServiceHandle lHwndSManager&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    End If&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;End Function&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;'Purpose     :  Changes the state of an NT Service&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;'Inputs      :  sServiceName                The name of the service to test&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;'               [sComputerName]             The name of the machine to test the service status on.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;'                                           If unspecified uses the local machine&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;'Outputs     :  N/A&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Public Function ServiceStateChange(sServiceName As String, eState As eServiceState, Optional sComputerName As String) As Boolean&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Dim tServiceStatus As SERVICE_STATUS&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Dim lHwndSManager As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Dim lHwndService As Long&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Dim lRes As Long&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    'Check the input data&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    If InStr(1, sServiceName, " ") Then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        Debug.Print "Service names cannot contain spaces. Use the 'Service Name' of the service, not the 'Display Name'"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        ServiceStateChange = False&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        Exit Function&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    End If&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    'Open the service manager&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    lHwndSManager = OpenSCManager(sComputerName, SERVICES_ACTIVE_DATABASE, SC_MANAGER_ALL_ACCESS)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    If lHwndSManager &lt;&gt; 0 Then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        'Open the service&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        lHwndService = OpenService(lHwndSManager, sServiceName, SERVICE_ALL_ACCESS)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        If lHwndService &lt;&gt; 0 Then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            Select Case eState&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            Case essPauseService&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                'Pause the service&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                lRes = ControlService(lHwndService, SERVICE_CONTROL_PAUSE, tServiceStatus)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            Case essStartService&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                'Start the service&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                lRes = StartService(lHwndService, 0, 0)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            Case essStopService&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                lRes = ControlService(lHwndService, SERVICE_CONTROL_STOP, tServiceStatus)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            Case Else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                Debug.Print "Invalid Service State"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                Debug.Assert False&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            End Select&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            If lRes Then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                'Success&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                ServiceStateChange = True&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            Else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                'Failed&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                ServiceStateChange = False&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                Debug.Print "Error in ServiceStateChange: " &amp;amp; Err.LastDllError&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;                Debug.Assert False&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            End If&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;            CloseServiceHandle lHwndService&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        End If&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        CloseServiceHandle lHwndSManager&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        Debug.Print "Failed to open service mananger!"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        Debug.Assert False&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        ServiceStateChange = False&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    End If&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;End Function&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;'Demonstration routine using the "Windows Time" service&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;Sub Test()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Dim sStatus As String&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    sStatus = ServiceStatus("W32Time")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Debug.Print "Event Log is now " &amp;amp; sStatus&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Call ServiceStateChange("W32Time", essStopService)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    sStatus = ServiceStatus("W32Time")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Debug.Print "Event Log is now " &amp;amp; sStatus&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Call ServiceStateChange("W32Time", essStartService)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    sStatus = ServiceStatus("Eventlog")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;    Debug.Print "Event Log is now " &amp;amp; sStatus&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;End Sub&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-1750599343470427082?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/1750599343470427082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=1750599343470427082' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/1750599343470427082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/1750599343470427082'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/start-stop-and-pause-nt-services.html' title='Start, Stop and Pause NT Services'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-7147943305151235844</id><published>2009-02-04T02:43:00.000-08:00</published><updated>2009-02-04T02:44:46.547-08:00</updated><title type='text'>Determining the system folder locations</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;Option Explicit&lt;br /&gt;&lt;br /&gt;Public Enum epPath&lt;br /&gt;    CSIDL_DESKTOP = &amp;amp;H0&lt;br /&gt;    CSIDL_INTERNET = &amp;amp;H1&lt;br /&gt;    CSIDL_PROGRAMS = &amp;amp;H2&lt;br /&gt;    CSIDL_CONTROLS = &amp;amp;H3&lt;br /&gt;    CSIDL_PRINTERS = &amp;amp;H4&lt;br /&gt;    CSIDL_PERSONAL = &amp;amp;H5&lt;br /&gt;    CSIDL_FAVORITES = &amp;amp;H6&lt;br /&gt;    CSIDL_STARTUP = &amp;amp;H7&lt;br /&gt;    CSIDL_RECENT = &amp;amp;H8&lt;br /&gt;    CSIDL_SENDTO = &amp;amp;H9&lt;br /&gt;    CSIDL_BITBUCKET = &amp;amp;HA&lt;br /&gt;    CSIDL_STARTMENU = &amp;amp;HB&lt;br /&gt;    CSIDL_DESKTOPDIRECTORY = &amp;amp;H10&lt;br /&gt;    CSIDL_DRIVES = &amp;amp;H11&lt;br /&gt;    CSIDL_NETWORK = &amp;amp;H12&lt;br /&gt;    CSIDL_NETHOOD = &amp;amp;H13&lt;br /&gt;    CSIDL_FONTS = &amp;amp;H14&lt;br /&gt;    CSIDL_TEMPLATES = &amp;amp;H15&lt;br /&gt;    CSIDL_COMMON_STARTMENU = &amp;amp;H16&lt;br /&gt;    CSIDL_COMMON_PROGRAMS = &amp;amp;H17&lt;br /&gt;    CSIDL_COMMON_STARTUP = &amp;amp;H18&lt;br /&gt;    CSIDL_COMMON_DESKTOPDIRECTORY = &amp;amp;H19&lt;br /&gt;    CSIDL_APPDATA = &amp;amp;H1A&lt;br /&gt;    CSIDL_PRINTHOOD = &amp;amp;H1B&lt;br /&gt;    CSIDL_LOCAL_APPDATA = &amp;amp;H1C&lt;br /&gt;    CSIDL_ALTSTARTUP = &amp;amp;H1D&lt;br /&gt;    CSIDL_COMMON_ALTSTARTUP = &amp;amp;H1E&lt;br /&gt;    CSIDL_COMMON_FAVORITES = &amp;amp;H1F&lt;br /&gt;    CSIDL_INTERNET_CACHE = &amp;amp;H20&lt;br /&gt;    CSIDL_COOKIES = &amp;amp;H21&lt;br /&gt;    CSIDL_HISTORY = &amp;amp;H22&lt;br /&gt;    CSIDL_COMMON_APPDATA = &amp;amp;H23&lt;br /&gt;    CSIDL_WINDOWS = &amp;amp;H24&lt;br /&gt;    CSIDL_SYSTEM = &amp;amp;H25&lt;br /&gt;    CSIDL_PROGRAM_FILES = &amp;amp;H26&lt;br /&gt;    CSIDL_MYPICTURES = &amp;amp;H27&lt;br /&gt;    CSIDL_PROFILE = &amp;amp;H28&lt;br /&gt;    CSIDL_SYSTEMX86 = &amp;amp;H29&lt;br /&gt;    CSIDL_PROGRAM_FILESX86 = &amp;amp;H2A&lt;br /&gt;    CSIDL_PROGRAM_FILES_COMMON = &amp;amp;H2B&lt;br /&gt;    CSIDL_PROGRAM_FILES_COMMONX86 = &amp;amp;H2C&lt;br /&gt;    CSIDL_COMMON_TEMPLATES = &amp;amp;H2D&lt;br /&gt;    CSIDL_COMMON_DOCUMENTS = &amp;amp;H2E&lt;br /&gt;    CSIDL_COMMON_ADMINTOOLS = &amp;amp;H2F&lt;br /&gt;    CSIDL_ADMINTOOLS = &amp;amp;H30&lt;br /&gt;    CSIDL_FLAG_CREATE = &amp;amp;H8000&amp;amp;&lt;br /&gt;    CSIDL_FLAG_DONT_VERIFY = &amp;amp;H4000&lt;br /&gt;    CSIDL_FLAG_MASK = &amp;amp;HFF00&lt;br /&gt;End Enum&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long&lt;br /&gt;Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long&lt;br /&gt;&lt;br /&gt;Private Type SHITEMID&lt;br /&gt;    CB As Long&lt;br /&gt;    AbID As Byte&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Private Type ITEMIDLIST&lt;br /&gt;    Mkid As SHITEMID&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;Public Type SpecialFolder&lt;br /&gt;    FolderPath As String&lt;br /&gt;    FolderType As epPath&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;'Purpose     :  Returns an array of special folders&lt;br /&gt;'Inputs      :&lt;br /&gt;'Outputs     :  Returns an array of the special folders.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Function GetAllSpecialFolders() As SpecialFolder()&lt;br /&gt;    Dim lThisFolder As Long, lNumFolders As Long&lt;br /&gt;    Dim sFolderPath As String&lt;br /&gt;    Dim resultArray() As SpecialFolder&lt;br /&gt;   &lt;br /&gt;    Const clMaxFolders As Long = 255&lt;br /&gt;   &lt;br /&gt;    On Error GoTo ErrFailed&lt;br /&gt;    Erase resultArray&lt;br /&gt;    'Return All Folders&lt;br /&gt;    ReDim resultArray(1 To clMaxFolders)&lt;br /&gt;    For lThisFolder = 0 To clMaxFolders&lt;br /&gt;        sFolderPath = UCase$(GetSpecialFolder(lThisFolder))&lt;br /&gt;        If Len(sFolderPath) Then&lt;br /&gt;            lNumFolders = lNumFolders + 1&lt;br /&gt;            resultArray(lNumFolders).FolderPath = sFolderPath&lt;br /&gt;            resultArray(lNumFolders).FolderType = lThisFolder&lt;br /&gt;        End If&lt;br /&gt;    Next&lt;br /&gt;   &lt;br /&gt;    If lNumFolders Then&lt;br /&gt;        ReDim Preserve resultArray(1 To lNumFolders)&lt;br /&gt;        GetAllSpecialFolders = resultArray&lt;br /&gt;    Else&lt;br /&gt;        GetAllSpecialFolders = Empty&lt;br /&gt;    End If&lt;br /&gt;   &lt;br /&gt;    Exit Function&lt;br /&gt;ErrFailed:&lt;br /&gt;    GetAllSpecialFolders = Empty&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;Function GetSpecialFolder(eFolderID As epPath) As String&lt;br /&gt;    Dim tRetVal As Long, sBuffer As String&lt;br /&gt;    Dim tIDL As ITEMIDLIST&lt;br /&gt;    Const NO_ERROR = 0&lt;br /&gt;   &lt;br /&gt;    'Get the special folder&lt;br /&gt;    tRetVal = SHGetSpecialFolderLocation(100&amp;amp;, eFolderID, tIDL)&lt;br /&gt;    If tRetVal = NO_ERROR Then&lt;br /&gt;        'Create a buffer&lt;br /&gt;        sBuffer = Space$(512)&lt;br /&gt;        'Get the path from the IDList&lt;br /&gt;        tRetVal = SHGetPathFromIDList(ByVal tIDL.Mkid.CB, ByVal sBuffer)&lt;br /&gt;        'Remove the unnecesarry chr$(0)'s&lt;br /&gt;        GetSpecialFolder = Left$(sBuffer, InStr(1, sBuffer, vbNullChar) - 1)&lt;br /&gt;        If Right$(GetSpecialFolder, 1) &lt;&gt; "\" And Len(GetSpecialFolder) &gt; 0 Then&lt;br /&gt;            GetSpecialFolder = GetSpecialFolder &amp;amp; "\"&lt;br /&gt;        End If&lt;br /&gt;    End If&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;'Demonstration routine&lt;br /&gt;Sub Test()&lt;br /&gt;    Dim atFolders() As SpecialFolder, tFolder As SpecialFolder, folder As Integer&lt;br /&gt;    'Get all special folders&lt;br /&gt;    atFolders = GetAllSpecialFolders()&lt;br /&gt;    For folder = 1 To UBound(atFolders)&lt;br /&gt;        tFolder = atFolders(folder)&lt;br /&gt;        Debug.Print "Type: " &amp;amp; tFolder.FolderType &amp;amp; ". Path: " &amp;amp; tFolder.FolderPath&lt;br /&gt;    Next&lt;br /&gt;&lt;br /&gt;    'Get the start menu folder location&lt;br /&gt;    Debug.Print GetSpecialFolder(CSIDL_STARTMENU)&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-7147943305151235844?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/7147943305151235844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=7147943305151235844' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/7147943305151235844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/7147943305151235844'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/determining-system-folder-locations.html' title='Determining the system folder locations'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-2874112821318053166</id><published>2009-02-03T07:16:00.000-08:00</published><updated>2009-02-03T07:33:01.231-08:00</updated><title type='text'>Preview an Access Database Report</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;The function below can be used to preview a report created in MS Access.&lt;br /&gt;&lt;br /&gt;'Purpose   :    Preview an Access Report from VB&lt;br /&gt;'Inputs    :    sAccessDBPath           The path and filename of the access database containing the report to show&lt;br /&gt;'               sReportName             The name of the report to show&lt;br /&gt;'Outputs   :    Returns an empty string on success, else returns an error message.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Function AccessShowReport(sAccessDBPath As String, sReportName As String) As String&lt;br /&gt;    Dim oAccess As Object 'Access.Application&lt;br /&gt;   &lt;br /&gt;    On Error GoTo ErrFailed&lt;br /&gt;    AccessShowReport = ""&lt;br /&gt;    'Create Access&lt;br /&gt;    Set oAccess = CreateObject("Access.Application")&lt;br /&gt;    'Open Database&lt;br /&gt;    oAccess.OpenCurrentDatabase sAccessDBPath&lt;br /&gt;    'Open report&lt;br /&gt;    oAccess.DoCmd.OpenReport sReportName, 0 'acViewNormal&lt;br /&gt;    'Show Access Report&lt;br /&gt;    oAccess.Visible = True&lt;br /&gt;    oAccess.CloseCurrentDatabase&lt;br /&gt;    Set oAccess = Nothing&lt;br /&gt;    Exit Function&lt;br /&gt;&lt;br /&gt;ErrFailed:&lt;br /&gt;    Debug.Print Err.Description&lt;br /&gt;    Debug.Assert False&lt;br /&gt;    AccessShowReport = Err.Description&lt;br /&gt;    If oAccess Is Nothing = False Then&lt;br /&gt;        oAccess.CloseCurrentDatabase&lt;br /&gt;        Set oAccess = Nothing&lt;br /&gt;    End If&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-2874112821318053166?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/2874112821318053166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=2874112821318053166' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/2874112821318053166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/2874112821318053166'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/preview-access-database-report.html' title='Preview an Access Database Report'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-9193930889828955205</id><published>2009-02-03T07:07:00.000-08:00</published><updated>2009-02-03T07:15:09.105-08:00</updated><title type='text'>Repoint an Access Link table using ADO-ADOX</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;The following routine repoints a link table to a different database.&lt;br /&gt;&lt;br /&gt;'Purpose     :  Updates the underlying source of a link table in an Access database&lt;br /&gt;'Inputs      :  sLinkDatabasePath path to the database.&lt;br /&gt;'               sLinkToNewDatabase The path to the database repoint the link to.&lt;br /&gt;'               sLinkTableName name of the link table to repoint.&lt;br /&gt;'Outputs     :  Returns True if succeeded in repointing the table&lt;br /&gt;'Notes       :  Requires a reference to reference to both ADO (MS ActiveX Data Objects) and MSADOX.DLL&lt;br /&gt;'               (MS ADO Ext. 2.5 DLL and Security).&lt;br /&gt;'Revisions   :&lt;br /&gt;&lt;br /&gt;Function AccessLinkTableUpdate(sLinkDatabasePath As String, sLinkToNewDatabase As String, sLinkTableName As String) As Boolean&lt;br /&gt;&lt;br /&gt;Dim catDB As ADOX.Catalog&lt;br /&gt;   &lt;br /&gt; On Error GoTo ErrFailed&lt;br /&gt; Set catDB = New ADOX.Catalog&lt;br /&gt;    'Open a catalog on the database which contains the table to refresh.&lt;br /&gt;.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" &amp;amp; "Data Source=" &amp;amp; sLinkDatabasePath&lt;br /&gt; catDB.Tables(sLinkTableName).Type = "LINK" Then&lt;br /&gt;.Tables(sLinkTableName).Properties("Jet OLEDB:Link Datasource") = sLinkToNewDatabase&lt;br /&gt;AccessLinkTableUpdate = True&lt;br /&gt;    End If&lt;br /&gt;    Set catDB = Nothing&lt;br /&gt;    Exit Function&lt;br /&gt;&lt;br /&gt;ErrFailed:&lt;br /&gt;    On Error GoTo 0&lt;br /&gt;    AccessLinkTableUpdate = False&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-9193930889828955205?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/9193930889828955205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=9193930889828955205' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/9193930889828955205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/9193930889828955205'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/repoint-access-link-table-using-ado.html' title='Repoint an Access Link table using ADO-ADOX'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-8835093748265477701</id><published>2009-02-03T07:03:00.000-08:00</published><updated>2009-02-03T07:05:42.582-08:00</updated><title type='text'>Read data from a workbook using ADO</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;&lt;span style="font-family: verdana; font-weight: bold;"&gt;The following code reads data from closed Excel workbooks using ADO with an ODBC driver.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;Purpose     :  Extracts data from a closed workbook to an array&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;Inputs      :  sSourceFile                     The path and file name of the workbook to read data from.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;               sRange                          The range reference (or named range) to read the data from.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;               [sSheetName]                    The name of the sheet to return the data from. If not specified returns&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;                                               data from first sheet.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;               [bReturnHeadings]               If True returns the Column Headings (i.e. the first row in the range).&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;                                               Note: This alters the shape of the output array to an array in an array.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;Outputs     :  Returns a 2d variant array containing the values in the specified range.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;Notes       :  Requires a reference to the Microsoft ActiveX Data Objects library&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;Could also use OLEDB JET 4.0 Driver &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &amp;amp; sSourceFile &amp;amp; ";Extended Properties=""Excel 8.0;HDR=Yes"""&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Function WorkbookReadRange(sSourceFile As String, sRange As String, Optional sSheetName As String, Optional bReturnHeadings As Boolean) As Variant&lt;br /&gt;    Dim conWkb As ADODB.Connection, rsWkbCells As ADODB.Recordset, sConString As String&lt;br /&gt;    Dim lThisField As Long, avResults As Variant, avHeadings As Variant&lt;br /&gt;   &lt;br /&gt;    On Error GoTo ErrFailed&lt;br /&gt;    sConString = "DRIVER={Microsoft Excel Driver (*.xls)};ReadOnly=1;DBQ=" &amp;amp; sSourceFile&lt;br /&gt;    Set conWkb = New ADODB.Connection&lt;br /&gt;    'open connection&lt;br /&gt;    conWkb.Open sConString&lt;br /&gt;    If Len(sSheetName) Then&lt;br /&gt;        'Get data from specified sheet&lt;br /&gt;        Set rsWkbCells = conWkb.Execute("Select * from " &amp;amp; Chr(34) &amp;amp; sSheetName &amp;amp; "$" &amp;amp; sRange &amp;amp; Chr$(34))&lt;br /&gt;    Else&lt;br /&gt;        'Get data from first sheet&lt;br /&gt;        Set rsWkbCells = conWkb.Execute("Select * from " &amp;amp; sRange)&lt;br /&gt;    End If&lt;br /&gt;    If rsWkbCells.EOF Then&lt;br /&gt;        'Return a 1d array&lt;br /&gt;        'Get headings&lt;br /&gt;        ReDim avHeadings(0 To 0, 0 To rsWkbCells.Fields.Count - 1)&lt;br /&gt;        For lThisField = 0 To rsWkbCells.Fields.Count - 1&lt;br /&gt;            avHeadings(0, lThisField) = rsWkbCells.Fields(lThisField).Name&lt;br /&gt;        Next&lt;br /&gt;        WorkbookReadRange = avHeadings&lt;br /&gt;    Else&lt;br /&gt;        'Return a 2d array&lt;br /&gt;        If bReturnHeadings Then&lt;br /&gt;            'Get cells&lt;br /&gt;            avResults = rsWkbCells.GetRows&lt;br /&gt;            'Get headings&lt;br /&gt;            ReDim avHeadings(0 To rsWkbCells.Fields.Count - 1, 0 To 0)&lt;br /&gt;            For lThisField = 0 To rsWkbCells.Fields.Count - 1&lt;br /&gt;                avHeadings(lThisField, 0) = rsWkbCells.Fields(lThisField).Name&lt;br /&gt;            Next&lt;br /&gt;            WorkbookReadRange = Array(avHeadings, avResults)&lt;br /&gt;        Else&lt;br /&gt;            'Get cells&lt;br /&gt;            WorkbookReadRange = rsWkbCells.GetRows&lt;br /&gt;        End If&lt;br /&gt;    End If&lt;br /&gt;    'Disconnect and destroy DB objects&lt;br /&gt;    rsWkbCells.Close&lt;br /&gt;    conWkb.Close&lt;br /&gt;    Set rsWkbCells = Nothing&lt;br /&gt;    Set conWkb = Nothing&lt;br /&gt;    On Error GoTo 0&lt;br /&gt;    Exit Function&lt;br /&gt;&lt;br /&gt;ErrFailed:&lt;br /&gt;   'Return error message&lt;br /&gt;    WorkbookReadRange = Err.Description&lt;br /&gt;&lt;br /&gt;    If conWkb.State &lt;&gt; adStateClosed Then&lt;br /&gt;        conWkb.Close&lt;br /&gt;    End If&lt;br /&gt;  &lt;br /&gt;    Set rsWkbCells = Nothing&lt;br /&gt;    Set conWkb = Nothing&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;'Demonstration Routine&lt;br /&gt;Sub Test()&lt;br /&gt;    Dim avCellValues As Variant, vThisCell As Variant&lt;br /&gt;    avCellValues = WorkbookReadRange("C:\book1.xls", "A1:B2", "Sheet1")&lt;br /&gt;    If IsArray(avCellValues) Then&lt;br /&gt;        For Each vThisCell In avCellValues&lt;br /&gt;            Debug.Print vThisCell&lt;br /&gt;        Next&lt;br /&gt;    End If&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-8835093748265477701?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/8835093748265477701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=8835093748265477701' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/8835093748265477701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/8835093748265477701'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/read-data-from-workbook-using-ado.html' title='Read data from a workbook using ADO'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-7310819550222592545</id><published>2009-02-03T06:59:00.000-08:00</published><updated>2009-02-03T07:01:28.281-08:00</updated><title type='text'>Return table names from Access-SQL Server</title><content type='html'>&lt;div style="text-align: justify; font-family: verdana;"&gt;&lt;span style="font-weight: bold;"&gt;The function below uses ADOX (Microsoft ADO Ext 2.5 for DLL and Security) to&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;return all the table names for a given connection or connection string.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Purpose   :    Returns all the tables in an Access or SQL Server database&lt;br /&gt;Inputs    :     A valid connection string or ADO Connection&lt;br /&gt;Outputs   :    A collection of Table Names&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;CODE : &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Public Function TableNames(Optional sConnectionString As String, Optional cCN As ADODB.Connection) As Collection&lt;br /&gt;    Dim oCatalog As New ADOX.Catalog, colTableNames As New Collection&lt;br /&gt;    Dim oTables As ADOX.Tables, oTable As ADOX.Table&lt;br /&gt;    Dim oConnection As New ADODB.Connection&lt;br /&gt;   &lt;br /&gt;    On Error GoTo ExitSub&lt;br /&gt;    If Len(sConnectionString) Then&lt;br /&gt;        oConnection.ConnectionString = sConnectionString&lt;br /&gt;        oConnection.Open sConnectionString&lt;br /&gt;    Else&lt;br /&gt;        Set oConnection = cCN&lt;br /&gt;    End If&lt;br /&gt;    Set oCatalog.ActiveConnection = oConnection&lt;br /&gt;    Set oTables = oCatalog.Tables&lt;br /&gt;   &lt;br /&gt;    For Each oTable In oTables&lt;br /&gt;        colTableNames.Add oTable.Name&lt;br /&gt;    Next&lt;br /&gt;    Set TableNames = colTableNames&lt;br /&gt;&lt;br /&gt;ExitSub:&lt;br /&gt;    On Error Resume Next&lt;br /&gt;    If Len(sConnectionString) Then&lt;br /&gt;        'Close Temporary Connection&lt;br /&gt;        If oConnection.State &lt;&gt; 0 Then&lt;br /&gt;            oConnection.Close&lt;br /&gt;        End If&lt;br /&gt;    End If&lt;br /&gt;    Set oConnection = Nothing&lt;br /&gt;    Set oCatalog = Nothing&lt;br /&gt;    Set oTable = Nothing&lt;br /&gt;    Set oTables = Nothing&lt;br /&gt;    Exit Function&lt;br /&gt;ErrFailed:&lt;br /&gt;    Debug.Print Err.Description&lt;br /&gt;    Debug.Assert False&lt;br /&gt;    Resume ExitSub&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;'Example&lt;br /&gt;Private Sub Form_Load()&lt;br /&gt;    Dim colTableNames As Collection, vTable As Variant&lt;br /&gt;    Set colTableNames = TableNames("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\GFX-IT\database\support.mdb; Persist Security Info=False")&lt;br /&gt;    For Each vTable In colTableNames&lt;br /&gt;        Debug.Print "Table Name: " &amp;amp; vTable&lt;br /&gt;    Next&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-7310819550222592545?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/7310819550222592545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=7310819550222592545' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/7310819550222592545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/7310819550222592545'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/return-table-names-from-access-sql.html' title='Return table names from Access-SQL Server'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-1432880513670473128</id><published>2009-02-03T06:54:00.000-08:00</published><updated>2009-02-03T06:58:09.574-08:00</updated><title type='text'>Retrieve a list of the users logged on to an Access-Jet Database</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;Option Explicit&lt;br /&gt;&lt;br /&gt;'----------Type to hold results------------&lt;br /&gt;'For each person who opens a shared database, the Jet database engine writes an entry&lt;br /&gt;'in the database's .ldb file. The size of each .ldb entry is 64 bytes. The first 32&lt;br /&gt;'bytes contains the computer name. The second 32 bytes contains the&lt;br /&gt;'security name (such as Admin).&lt;br /&gt;Private Type tDBUser&lt;br /&gt;    UserName As String * 32&lt;br /&gt;    SecurityName As String * 32&lt;br /&gt;End Type&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;'Purpose     :  Retreives a list of users attached to an Access Database by parsing the ldb file&lt;br /&gt;'Inputs      :  asUsers                         See outputs&lt;br /&gt;'               sLDBFilePath                    The path and file name of the ldb file&lt;br /&gt;'Outputs     :  asUsers                         A 2d string array 1 to 2, 1 to Number of users&lt;br /&gt;'                                               Where   asUsers(1,1)      =       First user name&lt;br /&gt;'                                                       asUsers(2,1)      =       User's security access&lt;br /&gt;'               Returns 0 if their are no users or the lock file doesn't exist.&lt;br /&gt;'               Returns -1 on error.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Function DatabaseUsers(ByRef asUsers() As String, sLDBFilePath As String) As Long&lt;br /&gt;    Const clMaxUsers As Long = 255      'The maximum number of concurrent users that the Jet database engine supports is 255&lt;br /&gt;    Dim iFileNum As Integer&lt;br /&gt;    Dim tThisUser As tDBUser&lt;br /&gt;   &lt;br /&gt;    On Error GoTo ErrFailed&lt;br /&gt;    If Len(Dir$(sLDBFilePath)) &gt; 0 And Len(sLDBFilePath) &gt; 0 Then&lt;br /&gt;        'Lock file exists, open file.&lt;br /&gt;        iFileNum = FreeFile&lt;br /&gt;        Open sLDBFilePath For Random As #iFileNum Len = Len(tThisUser)&lt;br /&gt;        'Create buffer to store results&lt;br /&gt;        ReDim asUsers(1 To 2, 1 To clMaxUsers)&lt;br /&gt;        'Read data into fixed length type&lt;br /&gt;        Get iFileNum, 1, tThisUser&lt;br /&gt;        Do While Not EOF(iFileNum)&lt;br /&gt;            DatabaseUsers = DatabaseUsers + 1&lt;br /&gt;            asUsers(1, DatabaseUsers) = Left$(tThisUser.UserName, InStr(1, tThisUser.UserName, vbNullChar) - 1)&lt;br /&gt;            asUsers(2, DatabaseUsers) = Left$(tThisUser.SecurityName, InStr(1, tThisUser.SecurityName, vbNullChar) - 1)&lt;br /&gt;            'Read next record&lt;br /&gt;            Get iFileNum, DatabaseUsers + 1, tThisUser&lt;br /&gt;        Loop&lt;br /&gt;        'Close file&lt;br /&gt;        Close #iFileNum&lt;br /&gt;        'Resize results&lt;br /&gt;        ReDim Preserve asUsers(1 To 2, 1 To DatabaseUsers)&lt;br /&gt;    Else&lt;br /&gt;        'No users attached&lt;br /&gt;        Erase asUsers&lt;br /&gt;    End If&lt;br /&gt;    Exit Function&lt;br /&gt;ErrFailed:&lt;br /&gt;    DatabaseUsers = -1&lt;br /&gt;    Erase asUsers&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;'Demonstration routine&lt;br /&gt;Sub Test()&lt;br /&gt;    Dim asUsers() As String, lNumUsers As Long, lThisUser As Long&lt;br /&gt;&lt;br /&gt;    lNumUsers = DatabaseUsers(asUsers, "D:\Work\Visual Basic\Net Send\NetSend.ldb")&lt;br /&gt;    For lThisUser = 1 To lNumUsers&lt;br /&gt;        Debug.Print "User Name: " &amp;amp; asUsers(1, lThisUser)&lt;br /&gt;        Debug.Print "Security : " &amp;amp; asUsers(2, lThisUser)&lt;br /&gt;    Next&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-1432880513670473128?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/1432880513670473128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=1432880513670473128' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/1432880513670473128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/1432880513670473128'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/retrieve-list-of-users-logged-on-to.html' title='Retrieve a list of the users logged on to an Access-Jet Database'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-2215938123736312766</id><published>2009-02-03T06:49:00.000-08:00</published><updated>2009-02-03T06:53:08.272-08:00</updated><title type='text'>Returning an asynchronous client side recorset with ADO</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;The following function below illustrates how you would run an ADO client side (disconnected) query asynchronously:&lt;br /&gt;&lt;br /&gt;Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)&lt;br /&gt;&lt;br /&gt;'Purpose     :  Executes a disconnect ADO query asynchronously.&lt;br /&gt;'Inputs      :  sSql                            The SQL to execute.&lt;br /&gt;'               oCon                            The connection to execute against.&lt;br /&gt;'               [lQueryTimeout]                 If specified is the amount of time to wait (in secs) before aborting the query&lt;br /&gt;'Outputs     :  Returns a recordset contain the results of the query&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Function RecordsetOpenAsync(sSql As String, oCon As ADODB.Connection, Optional lQueryTimeout As Long = -1) As ADODB.Recordset&lt;br /&gt;    Dim oRs As ADODB.Recordset, lQueryTimeoutOld As Long&lt;br /&gt;    On Error GoTo ErrFailed&lt;br /&gt;   &lt;br /&gt;    'Create recordset&lt;br /&gt;    Set oRs = New Recordset&lt;br /&gt;   &lt;br /&gt;    If lQueryTimeout &lt;&gt; -1 Then&lt;br /&gt;        'Store and set query timeout&lt;br /&gt;        lQueryTimeoutOld = oCon.CommandTimeout&lt;br /&gt;        oCon.CommandTimeout = lQueryTimeout&lt;br /&gt;    End If&lt;br /&gt;   &lt;br /&gt;    'Set cursor to client&lt;br /&gt;    oRs.CursorLocation = adUseClient&lt;br /&gt;   &lt;br /&gt;    'Open recorset&lt;br /&gt;    'Using the "adAsyncExecute" option means the query returns immediately. If you&lt;br /&gt;    'use the "adAsync" option the query will return after "Initial Fetch Size" rows have been&lt;br /&gt;    'returned (see oRs.Properties("Initial Fetch Size") + oRs.Properties("Background Fetch Size"))&lt;br /&gt;    oRs.Open sSql, oCon, adOpenStatic, adLockBatchOptimistic, adAsyncExecute&lt;br /&gt;   &lt;br /&gt;    'Wait for recordset to finish fetching&lt;br /&gt;    Do While oRs.state &lt;&gt; adStateOpen&lt;br /&gt;        Sleep 20&lt;br /&gt;        DoEvents&lt;br /&gt;    Loop&lt;br /&gt;   &lt;br /&gt;    'Disconnect recordset&lt;br /&gt;    If oRs.EOF = False Then&lt;br /&gt;        'Results are pending. Move the cursor across the results to fetch them (onto the client)&lt;br /&gt;        oRs.MoveLast&lt;br /&gt;        oRs.MoveFirst&lt;br /&gt;    End If&lt;br /&gt;    'Release reference to connection&lt;br /&gt;    Set oRs.ActiveConnection = Nothing&lt;br /&gt;   &lt;br /&gt;    If lQueryTimeout &lt;&gt; -1 Then&lt;br /&gt;        'Restore query timeout&lt;br /&gt;        oCon.CommandTimeout = lQueryTimeoutOld&lt;br /&gt;    End If&lt;br /&gt;   &lt;br /&gt;    'Return recordset&lt;br /&gt;    Set RecordsetOpenAsync = oRs&lt;br /&gt;   &lt;br /&gt;    Exit Function&lt;br /&gt;   &lt;br /&gt;ErrFailed:&lt;br /&gt;    'Error occured&lt;br /&gt;    Debug.Print Err.Description&lt;br /&gt;    Debug.Assert False&lt;br /&gt;    Set RecordsetOpenAsync = Nothing&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-2215938123736312766?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/2215938123736312766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=2215938123736312766' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/2215938123736312766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/2215938123736312766'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/returning-asynchronous-client-side.html' title='Returning an asynchronous client side recorset with ADO'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-3498562871114263447</id><published>2009-02-03T06:45:00.000-08:00</published><updated>2009-02-03T06:49:03.206-08:00</updated><title type='text'>Updating a database using a disconnected recordset</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;Option Explicit&lt;br /&gt;&lt;br /&gt;'Purpose     :  Open a disconnected recordset.&lt;br /&gt;'Inputs      :  oCon                        The connection to open the recordset on.&lt;br /&gt;'               sSQL                        The SQL to open the recordset with.&lt;br /&gt;'               oRS                         The resulting recordset.&lt;br /&gt;'Outputs     :  Returns True if the recordset was opened and contained results.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Public Function RSOpenDisconnected(oCon As ADODB.Connection, sSQL As String, oRS As ADODB.Recordset, Optional eLocking As LockTypeEnum = adLockBatchOptimistic) As Boolean&lt;br /&gt;    On Error GoTo ErrFailed&lt;br /&gt;    If oCon.State = adStateOpen Then&lt;br /&gt;        'Connection is open&lt;br /&gt;        Set oRS = New ADODB.Recordset&lt;br /&gt;        'Set cursor to client (i.e. Local Machine)&lt;br /&gt;        oRS.CursorLocation = adUseClient&lt;br /&gt;        'Open Recordset (NB. The CursorType is always "adOpenStatic" for client-side cursors)&lt;br /&gt;        oRS.Open sSQL, oCon, adOpenStatic, eLocking&lt;br /&gt;        'Set connection to nothing (disconnect recordset)&lt;br /&gt;        Set oRS.ActiveConnection = Nothing&lt;br /&gt;        If oRS.EOF = False Then&lt;br /&gt;            'Return results&lt;br /&gt;            RSOpenDisconnected = True&lt;br /&gt;        Else&lt;br /&gt;            'Empty recorset&lt;br /&gt;            RSOpenDisconnected = False&lt;br /&gt;        End If&lt;br /&gt;    End If&lt;br /&gt;    Exit Function&lt;br /&gt;&lt;br /&gt;ErrFailed:&lt;br /&gt;    Debug.Print "Failed to open recordset: " &amp;amp; Err.Description&lt;br /&gt;    Debug.Assert False  'Error occurred&lt;br /&gt;    RSOpenDisconnected = False&lt;br /&gt;    On Error GoTo 0&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;'Demonstrates how to open a disconnected recordset and then update a value in&lt;br /&gt;'a field in the database.&lt;br /&gt;Sub Test()&lt;br /&gt;    Dim oRS As ADODB.Recordset&lt;br /&gt;    Dim oConn As ADODB.Connection&lt;br /&gt;    Const clRecordUpdated As Long = -2147217864&lt;br /&gt;   &lt;br /&gt;    On Error GoTo ErrUpdateFailed&lt;br /&gt;    'Open a connection to a database&lt;br /&gt;    Set oConn = New ADODB.Connection&lt;br /&gt;    oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyPath\MyDatabase.mdb; Persist Security Info=False"&lt;br /&gt;    'Open a disconnected recordset&lt;br /&gt;    RSOpenDisconnected oConn, "Select * from tblHoliday", oRS&lt;br /&gt;    'Update a field in the recordset&lt;br /&gt;    oRS.Fields("MyField").Value = "My New Value"&lt;br /&gt;    'Reconnect to database&lt;br /&gt;    Set oRS.ActiveConnection = oConn&lt;br /&gt;   &lt;br /&gt;    'Update table&lt;br /&gt;    oRS.UpdateBatch&lt;br /&gt;   &lt;br /&gt;    'Close the connection&lt;br /&gt;    oRS.Close&lt;br /&gt;    Set oRS = Nothing&lt;br /&gt;    oConn.Close&lt;br /&gt;    Set oConn = Nothing&lt;br /&gt;   &lt;br /&gt;    Exit Sub&lt;br /&gt;   &lt;br /&gt;ErrUpdateFailed:&lt;br /&gt;    If Err.Number = clRecordUpdated Then&lt;br /&gt;        MsgBox "The record you altered has been altered by another user... " &amp;amp; vbNewLine &amp;amp; Err.Description, vbCritical&lt;br /&gt;    Else&lt;br /&gt;        MsgBox "Error in disconnected update routine... " &amp;amp; vbNewLine &amp;amp; Err.Description, vbCritical&lt;br /&gt;    End If&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-3498562871114263447?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/3498562871114263447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=3498562871114263447' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/3498562871114263447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/3498562871114263447'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/02/updating-database-using-disconnected.html' title='Updating a database using a disconnected recordset'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-7761548258710159375</id><published>2009-01-30T22:52:00.000-08:00</published><updated>2009-01-30T22:57:27.480-08:00</updated><title type='text'>Adding a horizontal scroll bar to a listbox</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;Option Explicit&lt;br /&gt;&lt;br /&gt;Private Declare Function SendMessageA Lib "user32" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;'Purpose     :  Adds items to a listbox and if neccessary sets the&lt;br /&gt;'               width of the horizontal scroll bar to the maximum width of the&lt;br /&gt;'               items in the listbox.&lt;br /&gt;'Inputs      :  lbListbox                   The listbox to add the item to.&lt;br /&gt;'               sItemText                   The text to add to the listbox.&lt;br /&gt;'               [iIndex]                    The position within the object where the new item or row is placed.&lt;br /&gt;'Outputs     :  Returns True on success&lt;br /&gt;'Notes       :&lt;br /&gt;'Revisions   :&lt;br /&gt;'Assumptions : &lt;br /&gt;&lt;br /&gt;Function ListboxAddItem(lbListbox As ListBox, sItemText As String, Optional iIndex As Integer = -1) as Boolean&lt;br /&gt;    Dim fTextWidth As Single, fExistScrollWidth As Single&lt;br /&gt;    Dim oParentFont As StdFont&lt;br /&gt;    Const LB_SETHORIZONTALEXTENT = &amp;amp;H194, LB_GETHORIZONTALEXTENT = &amp;amp;H193&lt;br /&gt;&lt;br /&gt;    On Error Resume Next&lt;br /&gt;&lt;br /&gt;    'Add item to listbox&lt;br /&gt;    If iIndex &gt; -1 Then&lt;br /&gt;        lbListbox.AddItem sItemText, iIndex&lt;br /&gt;    Else&lt;br /&gt;        lbListbox.AddItem sItemText&lt;br /&gt;    End If&lt;br /&gt;&lt;br /&gt;    'Store the form's original font&lt;br /&gt;    Set oParentFont = lbListbox.Parent.Font&lt;br /&gt;    'Set the form's font to the listbox's font&lt;br /&gt;    Set lbListbox.Parent.Font = lbListbox.Font&lt;br /&gt;    'Get width of text on the form&lt;br /&gt;    fTextWidth = lbListbox.Parent.TextWidth(sItemText &amp;amp; " ")        'Extra space allows for vertical scroll bar&lt;br /&gt;    'Restore the form's font&lt;br /&gt;    Set lbListbox.Parent.Font = oParentFont&lt;br /&gt;   &lt;br /&gt;    'Get the width of the existing scroll bar&lt;br /&gt;    fExistScrollWidth = SendMessageA(lbListbox.hwnd, LB_GETHORIZONTALEXTENT, 0, 0)&lt;br /&gt;   &lt;br /&gt;    If lbListbox.Parent.ScaleMode = vbTwips Then&lt;br /&gt;        'Change twips to pixels&lt;br /&gt;        fTextWidth = fTextWidth / Screen.TwipsPerPixelX&lt;br /&gt;    End If&lt;br /&gt;   &lt;br /&gt;    If fTextWidth &gt; fExistScrollWidth Then&lt;br /&gt;        'Increase width of scroll bar&lt;br /&gt;        Call SendMessageA(lbListbox.hwnd, LB_SETHORIZONTALEXTENT, fTextWidth, 0)&lt;br /&gt;    End If&lt;br /&gt;    ListboxAddItem = (Err.Number = 0)&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;'Purpose     :  Modifies the text of an item in a listbox and if neccessary sets the&lt;br /&gt;'               width of the horizontal scroll bar to the maximum width of the&lt;br /&gt;'               items in the listbox.&lt;br /&gt;'Inputs      :  lbListbox                   The listbox to update the item in.&lt;br /&gt;'               sNewItemText                The new text for the item in the listbox.&lt;br /&gt;'               [iIndex]                    The index of the item to update within the listbox.&lt;br /&gt;'Outputs     :  Returns True on Success&lt;br /&gt;'Notes       :&lt;br /&gt;'Revisions   :&lt;br /&gt;'Assumptions :&lt;br /&gt;&lt;br /&gt;Function ListboxUpdateItem(lbListbox As ListBox, sNewItemText As String, iIndex As Integer) As Boolean&lt;br /&gt;    Dim fTextWidth As Single, fExistScrollWidth As Single&lt;br /&gt;    Dim oParentFont As StdFont&lt;br /&gt;    Const LB_SETHORIZONTALEXTENT = &amp;amp;H194, LB_GETHORIZONTALEXTENT = &amp;amp;H193&lt;br /&gt;   &lt;br /&gt;    'Add item to listbox&lt;br /&gt;    On Error GoTo ErrFailed&lt;br /&gt;    If lbListbox.List(iIndex) &lt;&gt; sNewItemText Then&lt;br /&gt;        lbListbox.List(iIndex) = sNewItemText&lt;br /&gt;        'Get width of text&lt;br /&gt;        Set oParentFont = lbListbox.Parent.Font&lt;br /&gt;        Set lbListbox.Parent.Font = lbListbox.Font&lt;br /&gt;        fTextWidth = lbListbox.Parent.TextWidth(sNewItemText &amp;amp; " ")        'Extra space allows for vertical scroll bar&lt;br /&gt;        Set lbListbox.Parent.Font = oParentFont&lt;br /&gt;        fExistScrollWidth = SendMessageA(lbListbox.hwnd, LB_GETHORIZONTALEXTENT, 0, 0)&lt;br /&gt;       &lt;br /&gt;        If lbListbox.Parent.ScaleMode = vbTwips Then&lt;br /&gt;            'Change twips to pixels&lt;br /&gt;            fTextWidth = fTextWidth / Screen.TwipsPerPixelX&lt;br /&gt;        End If&lt;br /&gt;       &lt;br /&gt;        If fTextWidth &gt; fExistScrollWidth Then&lt;br /&gt;            'Increase width of scroll bar&lt;br /&gt;            Call SendMessageA(lbListbox.hwnd, LB_SETHORIZONTALEXTENT, fTextWidth, 0)&lt;br /&gt;        End If&lt;br /&gt;    End If&lt;br /&gt;    ListboxUpdateItem = True&lt;br /&gt;&lt;br /&gt;    Exit Function&lt;br /&gt;   &lt;br /&gt;ErrFailed:&lt;br /&gt;    Debug.Print "Error in ListboxAddItem: " &amp;amp; lbListbox.Name &amp;amp; " Description: " &amp;amp; Err.Description&lt;br /&gt;    ListboxUpdateItem = False&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;'Purpose     :  Adds a horizontal scroll bar to a listbox&lt;br /&gt;'Inputs      :  lbListbox                   The listbox to add the scrollbar to.&lt;br /&gt;'Outputs     :  Returns True on success&lt;br /&gt;'Notes       :&lt;br /&gt;'Revisions   :&lt;br /&gt;'Assumptions :&lt;br /&gt;&lt;br /&gt;Function ListboxAddHorizontalScollBar(lbListbox As ListBox) As Boolean&lt;br /&gt;    On Error GoTo ErrFailed&lt;br /&gt;    Dim fTextWidth As Single&lt;br /&gt;    Dim oParentFont As StdFont, fExistScrollWidth As Single&lt;br /&gt;    Dim lThisListItem As Long, fMaxScollWidth As Single, lMaxTextLen As Long&lt;br /&gt;    Const LB_SETHORIZONTALEXTENT = &amp;amp;H194, LB_GETHORIZONTALEXTENT = &amp;amp;H193&lt;br /&gt;&lt;br /&gt;    'Add item to listbox&lt;br /&gt;    On Error GoTo ErrFailed&lt;br /&gt;    'Set the parent font&lt;br /&gt;    Set oParentFont = lbListbox.Parent.font&lt;br /&gt;    Set lbListbox.Parent.font = lbListbox.font&lt;br /&gt;    Set lbListbox.Parent.font = oParentFont&lt;br /&gt;&lt;br /&gt;    'Determine max. length of text&lt;br /&gt;    For lThisListItem = 0 To lbListbox.ListCount - 1&lt;br /&gt;        If Len(lbListbox.list(lThisListItem)) &gt; lMaxTextLen Then&lt;br /&gt;            lMaxTextLen = Len(lbListbox.list(lThisListItem))&lt;br /&gt;        End If&lt;br /&gt;    Next&lt;br /&gt;&lt;br /&gt;    'Get the text length&lt;br /&gt;    fTextWidth = lbListbox.Parent.TextWidth(String(lMaxTextLen + 1, "W"))       'Extra space allows for vertical scroll bar&lt;br /&gt;    'Restore the form's font&lt;br /&gt;    Set lbListbox.Parent.font = oParentFont&lt;br /&gt;&lt;br /&gt;    'Get the width of the existing scroll bar&lt;br /&gt;    fExistScrollWidth = SendMessage(lbListbox.hwnd, LB_GETHORIZONTALEXTENT, 0, 0)&lt;br /&gt;&lt;br /&gt;    If lbListbox.Parent.ScaleMode = vbTwips Then&lt;br /&gt;        'Change twips to pixels&lt;br /&gt;        fTextWidth = fTextWidth / Screen.TwipsPerPixelX&lt;br /&gt;    End If&lt;br /&gt;&lt;br /&gt;    If fTextWidth &gt; fExistScrollWidth Then&lt;br /&gt;        'Increase width of scroll bar&lt;br /&gt;        Call SendMessage(lbListbox.hwnd, LB_SETHORIZONTALEXTENT, fTextWidth, 0)&lt;br /&gt;    End If&lt;br /&gt;    ListboxAddHorizontalScollBar = (err.number = 0)&lt;br /&gt;   &lt;br /&gt;    Exit Function&lt;br /&gt;&lt;br /&gt;ErrFailed:&lt;br /&gt;    Debug.Print err.description&lt;br /&gt;    Debug.Assert False&lt;br /&gt;    ListboxAddHorizontalScollBar = (err.number = 0)&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-7761548258710159375?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/7761548258710159375/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=7761548258710159375' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/7761548258710159375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/7761548258710159375'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/01/adding-horizontal-scroll-bar-to-listbox.html' title='Adding a horizontal scroll bar to a listbox'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-1190106347530189788</id><published>2009-01-30T22:49:00.000-08:00</published><updated>2009-01-30T22:51:37.212-08:00</updated><title type='text'>Calling ODBC from ADO to connect to thirdparty driver</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;Dim ADOCN As New ADODB.Connection&lt;br /&gt;Dim ADORS As New ADODB.Recordset&lt;br /&gt;Dim mysql  As String&lt;br /&gt;With ADOCN&lt;br /&gt;'here how to call odbc from ADO!&lt;br /&gt;   .ConnectionString = "DSN=odbc namet;UID=YOURUSERID;PWD=YOURPASSWORD;"&lt;br /&gt;.Mode = adModeReadOnly&lt;br /&gt;   .Open&lt;br /&gt;End With&lt;br /&gt;&lt;br /&gt;With ADORS&lt;br /&gt;   .CursorLocation = adUseClient&lt;br /&gt;   .CursorType = adOpenKeyset&lt;br /&gt;   .LockType = adLockOptimistic&lt;br /&gt;   .ActiveConnection = ADOCN&lt;br /&gt;    mysql = "select whatever from my table"&lt;br /&gt;   .Source = mysql&lt;br /&gt;   .Open&lt;br /&gt;'for good preformance, I did store the record set in variant type variable so I can disconnect from host sooner&lt;br /&gt;&lt;br /&gt;.ctiveConnection = Nothing&lt;br /&gt;    myrows = .RecordCount&lt;br /&gt;    mycola = .Fields.Count&lt;br /&gt;    mydata = .GetRows()&lt;br /&gt;&lt;br /&gt;'now I can loop through my result&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-1190106347530189788?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/1190106347530189788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=1190106347530189788' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/1190106347530189788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/1190106347530189788'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/01/calling-odbc-from-ado-to-connect-to.html' title='Calling ODBC from ADO to connect to thirdparty driver'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-3665043713992582224</id><published>2009-01-30T22:41:00.000-08:00</published><updated>2009-01-30T22:48:29.839-08:00</updated><title type='text'>Sending Crystal Reports to MAPI</title><content type='html'>&lt;div style="text-align: justify; font-family: verdana;"&gt;Dim App as New craxdrt.Application&lt;br /&gt;Dim rpt as craxdrt.Report&lt;br /&gt;&lt;br /&gt;Set rpt = App.OpenReport("\\cms_live\Reports\Report Maker&lt;br /&gt;2k1\Admin\ImpBuddyProfile.RPT")&lt;br /&gt;&lt;br /&gt;   With rpt.ExportOptions&lt;br /&gt;                .DestinationType = crEDTEMailMAPI&lt;br /&gt;                .FormatType = crEFTPortableDocFormat&lt;br /&gt;&lt;br /&gt;                .MailToList = "steve"&lt;br /&gt;&lt;br /&gt;                .MailSubject = "Mail Subject"&lt;br /&gt;                .MailMessage = strMessage&lt;br /&gt;            End With&lt;br /&gt;&lt;br /&gt;            With rpt&lt;br /&gt;                .DisplayProgressDialog = False&lt;br /&gt;                .EnableParameterPrompting = False&lt;br /&gt;                .ParameterFields(1).AddCurrentValue "Any Old Value"&lt;br /&gt;                .Export False&lt;br /&gt;            End With&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-3665043713992582224?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/3665043713992582224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=3665043713992582224' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/3665043713992582224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/3665043713992582224'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/01/sending-crystal-reports-to-mapi.html' title='Sending Crystal Reports to MAPI'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-777147222083302726</id><published>2009-01-24T07:30:00.000-08:00</published><updated>2009-01-24T07:31:41.876-08:00</updated><title type='text'>Finding the position of the first character from a list of characters</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;&lt;span style="font-family: verdana;"&gt;The code below is useful when you want to find the position of first character from a list of characters within a string. This would typically be used when looking for carriage returns, eg:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;   &lt;span style="font-family: courier new;"&gt; Debug.Print StringFirstFirstChars(sSearch,vbNewline,vbCr,vbLf)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;The code below is useful when you want to find the position of first character from a list of characters within a string. This would typically be used when looking for carriage returns, eg:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    Debug.Print StringFirstFirstChars(sSearch,vbNewline,vbCr,vbLf)&lt;br /&gt;&lt;br /&gt;'Purpose     :  Finds the position of the first character found in a string from a list of characters.&lt;br /&gt;'Inputs      :  sSearchIn           The string to search for the first instance of a character from the character list&lt;br /&gt;'               avChars             The list of characters to search through "sSearchIn" for&lt;br /&gt;'Outputs     :  Returns the position of first instance of a character found in a string from the list of supplied characters,&lt;br /&gt;'               or zero if none of the characters are found&lt;br /&gt;'Example     :  If your wanted to find a line feed, you might use:&lt;br /&gt;'               Debug.Print StringFindFirstChar("ABCDEF","B","E","F")&lt;br /&gt;'               'This would return 2, i.e. the position of character "B"&lt;br /&gt;'Revisions   :&lt;br /&gt;&lt;br /&gt;Function StringFindFirstChar(sSearchIn As String, ParamArray avChars() As Variant) As Long&lt;br /&gt;    Dim lPosChar As Long, lPosTest As Long, vChar As Variant&lt;br /&gt;   &lt;br /&gt;    On Error GoTo ErrFailed&lt;br /&gt;    If Len(sSearchIn) Then&lt;br /&gt;        For Each vChar In avChars&lt;br /&gt;            lPosTest = InStr(1, sSearchIn, CStr(vChar))&lt;br /&gt;            If lPosTest Then&lt;br /&gt;                If lPosChar = 0 Then&lt;br /&gt;                    lPosChar = lPosTest&lt;br /&gt;                ElseIf lPosTest &lt; lPosChar Then&lt;br /&gt;                    lPosChar = lPosTest&lt;br /&gt;                End If&lt;br /&gt;            End If&lt;br /&gt;        Next&lt;br /&gt;    End If&lt;br /&gt;    StringFindFirstChar = lPosChar&lt;br /&gt;    Exit Function&lt;br /&gt;&lt;br /&gt;ErrFailed:&lt;br /&gt;    Debug.Print Err.Description&lt;br /&gt;    Debug.Assert False&lt;br /&gt;    'Try the next line&lt;br /&gt;    Resume Next&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-777147222083302726?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/777147222083302726/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=777147222083302726' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/777147222083302726'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/777147222083302726'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/01/finding-position-of-first-character_3358.html' title='Finding the position of the first character from a list of characters'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3509162107510152399.post-154585143504258845</id><published>2009-01-24T07:28:00.000-08:00</published><updated>2009-01-24T07:29:35.053-08:00</updated><title type='text'>Search for a specific string and replace it with another</title><content type='html'>&lt;div style="text-align: justify; font-family: courier new;"&gt;Function sReplace(SearchLine as String, SearchFor as String, ReplaceWith as String)&lt;br /&gt;    Dim vSearchLine as String, found as Integer&lt;br /&gt;   &lt;br /&gt;    found = InStr(SearchLine, SearchFor): vSearchLine = SearchLine&lt;br /&gt;    If found &lt;&gt; 0 Then&lt;br /&gt;        vSearchLine = ""&lt;br /&gt;        If found &gt; 1 Then vSearchLine = Left(SearchLine, found - 1)&lt;br /&gt;        vSearchLine = vSearchLine + ReplaceWith&lt;br /&gt;        If found + Len(SearchFor) - 1 &lt; Len(SearchLine) Then _&lt;br /&gt;            vSearchLine = vSearchLine + Right$(SearchLine, Len(SearchLine) - found - Len(SearchFor) + 1)&lt;br /&gt;    end If&lt;br /&gt;    sReplace = vSearchLine&lt;br /&gt;   &lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;* another routine *&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Only 17 lines of code for a super-fast find-and-replace function:&lt;br /&gt;&lt;br /&gt;-- start code --&lt;br /&gt;&lt;br /&gt;    '  Copy *both* functions to VBScript or VB application:&lt;br /&gt;    '  FindReplace and ReplaceFirstInstance&lt;br /&gt;    '&lt;br /&gt;    Function FindReplace(SourceString, SearchString, ReplaceString)&lt;br /&gt;        tmpString1 = SourceString&lt;br /&gt;        do Until vFixed&lt;br /&gt;            tmpString2 = tmpString1&lt;br /&gt;            tmpString1 = ReplaceFirstInstance(tmpString1, SearchString,ReplaceString)&lt;br /&gt;            If tmpString1 = tmpString2 Then vFixed = True&lt;br /&gt;        Loop&lt;br /&gt;        FindReplace = tmpString1&lt;br /&gt;    end Function&lt;br /&gt;&lt;br /&gt;    Function ReplaceFirstInstance(SourceString, SearchString, ReplaceString)&lt;br /&gt;        FoundLoc = InStr(1, SourceString, SearchString)&lt;br /&gt;        If FoundLoc &lt;&gt; 0 Then&lt;br /&gt;            ReplaceFirstInstance = Left(SourceString, FoundLoc - 1) &amp;amp; _&lt;br /&gt;        ReplaceString &amp;amp; Right(SourceString, _&lt;br /&gt;        Len(SourceString) - (FoundLoc - 1) - Len(SearchString))&lt;br /&gt;        Else&lt;br /&gt;            ReplaceFirstInstance = SourceString&lt;br /&gt;        end If&lt;br /&gt;    end Function&lt;br /&gt;&lt;br /&gt;--- end code -&lt;br /&gt;&lt;br /&gt; Just to clarify, one function is used to go through the entire string and&lt;br /&gt;replace all instances of the search string ("Replace All").  The other&lt;br /&gt;function is used to only replace the first instance of the search string&lt;br /&gt;("Replace").  The former loops the latter until there are no more instances&lt;br /&gt;of the search string.&lt;br /&gt;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Function FindReplace(SourceString, searchstring, replacestring)&lt;br /&gt;    tmpString1 = SourceString&lt;br /&gt;    do Until vFixed&lt;br /&gt;        tmpString2 = tmpString1&lt;br /&gt;        tmpString1 = ReplaceFirstInstance(tmpString1, searchstring,&lt;br /&gt;replacestring)&lt;br /&gt;        If tmpString1 = tmpString2 Then vFixed = True&lt;br /&gt;    loop&lt;br /&gt;    FindReplace = tmpString1&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;Function ReplaceFirstInstance(SourceString, searchstring, replacestring)&lt;br /&gt;    Static StartLoc '*&lt;br /&gt;    If StartLoc = 0 Then StartLoc = 1 '*&lt;br /&gt;    FoundLoc = InStr(StartLoc, SourceString, searchstring) '*&lt;br /&gt;    If FoundLoc &lt;&gt; 0 Then&lt;br /&gt;            ReplaceFirstInstance = Left(SourceString, FoundLoc - 1) &amp;amp; _&lt;br /&gt;            replacestring &amp;amp; Right(SourceString, _&lt;br /&gt;            Len(SourceString) - (FoundLoc - 1) - Len(searchstring))&lt;br /&gt;            StartLoc = FoundLoc + Len(replacestring) '*&lt;br /&gt;    Else&lt;br /&gt;        StartLoc = 1 '*&lt;br /&gt;        ReplaceFirstInstance = SourceString&lt;br /&gt;    end If&lt;br /&gt;End Function&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Return&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3509162107510152399-154585143504258845?l=lernvb.blogspot.com'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lernvb.blogspot.com/feeds/154585143504258845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=3509162107510152399&amp;postID=154585143504258845' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/154585143504258845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3509162107510152399/posts/default/154585143504258845'/><link rel='alternate' type='text/html' href='http://lernvb.blogspot.com/2009/01/search-for-specific-string-and-replace.html' title='Search for a specific string and replace it with another'/><author><name>Pankaj A.Hingade</name><uri>http://www.blogger.com/profile/04964875113190825498</uri><email>infocomputers108@gmail.com</email><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='OpenSocialUserId' value='11500826195518754085'/></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry></feed>