<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>VBA Tips &#38; Tricks 2008</title>
	<atom:link href="http://vba2008.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://vba2008.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Fri, 17 Oct 2008 06:02:43 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='vba2008.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/2b32dd9086d56bac1268bd553a35dc22?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>VBA Tips &#38; Tricks 2008</title>
		<link>http://vba2008.wordpress.com</link>
	</image>
			<item>
		<title>Extract eMail Data (Subject &amp; Body) Programatically using Outlook VBA</title>
		<link>http://vba2008.wordpress.com/2008/10/17/extract-email-data-subject-body-programatically-using-outlook-vba/</link>
		<comments>http://vba2008.wordpress.com/2008/10/17/extract-email-data-subject-body-programatically-using-outlook-vba/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 06:02:43 +0000</pubDate>
		<dc:creator>vbadud</dc:creator>
				<category><![CDATA[Outlook VBA]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://vba2008.wordpress.com/?p=68</guid>
		<description><![CDATA[
Extract Subject and Body of eMail through Outlook VBA

Many automation revolves around mails; you may want to trigger some process once a mail arrives in the InBox. The following code will help you extract the subject and body content of all mails in InBox
Sub Extract_Body_Subject_From_Mails()
Dim oNS As Outlook.NameSpace
Dim oFld As Outlook.Folder
Dim oMails As Outlook.Items
Dim oMailItem [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=68&subd=vba2008&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="post hentry uncustomized-post-template"><a name="6041148199717041590"></a></p>
<h3 class="post-title entry-title"><a href="http://vbadud.blogspot.com/2008/04/extract-subject-and-body-of-email.html">Extract Subject and Body of eMail through Outlook VBA</a></h3>
<div class="post-body entry-content">
<p>Many automation revolves around mails; you may want to trigger some process once a mail arrives in the InBox. The following code will help you extract the subject and body content of all mails in InBox</p>
<p><span style="color:#3333ff;">Sub Extract_Body_Subject_From_Mails()</span></p>
<p><span style="color:#3333ff;">Dim oNS As Outlook.NameSpace</span><br />
<span style="color:#3333ff;">Dim oFld As Outlook.Folder</span><br />
<span style="color:#3333ff;">Dim oMails As Outlook.Items</span><br />
<span style="color:#3333ff;">Dim oMailItem As Outlook.MailItem</span><br />
<span style="color:#3333ff;">Dim oProp As Outlook.PropertyPage</span></p>
<p><span style="color:#3333ff;">Dim sSubject As String</span><br />
<span style="color:#3333ff;">Dim sBody</span></p>
<p><span style="color:#3333ff;">On Error GoTo Err_OL</span></p>
<p><span style="color:#3333ff;">Set oNS = Application.GetNamespace(&#8220;MAPI&#8221;)</span><br />
<span style="color:#3333ff;">Set oFld = oNS.GetDefaultFolder(olFolderInbox)</span><br />
<span style="color:#3333ff;">Set oMails = oFld.Items</span></p>
<p><span style="color:#3333ff;">For Each oMailItem In oMails</span><br />
<span style="color:#3333ff;">sBody = oMailItem.Body</span><br />
<span style="color:#3333ff;">sSubject = oMailItem.Subject &#8216;This property corresponds to the MAPI property PR_SUBJECT. The Subject property is the default property for Outlook items.</span><br />
<span style="color:#3333ff;">Next</span></p>
<p><span style="color:#3333ff;">Exit Sub</span><br />
<span style="color:#3333ff;">Err_OL:</span><br />
<span style="color:#3333ff;">If Err &lt;&gt; 0 Then</span><br />
<span style="color:#3333ff;">MsgBox Err.Number &amp; &#8221; &#8211; &#8221; &amp; Err.Description</span><br />
<span style="color:#3333ff;">Err.Clear</span><br />
<span style="color:#3333ff;">Resume Next</span><br />
<span style="color:#3333ff;">End If</span><br />
<span style="color:#3333ff;">End Sub</span></p>
<p>The Subject property is the default property for Outlook items.</p></div>
<div class="post-footer">
<div class="post-footer-line post-footer-line-1"><span class="post-author vcard">Posted by <span class="fn">Shasur</span> </span><span class="post-timestamp">at <a class="timestamp-link" title="permanent link" rel="bookmark" href="http://vbadud.blogspot.com/2008/04/extract-subject-and-body-of-email.html"><abbr class="published" title="00"><span style="color:#225588;">5:38 AM</span></abbr></a> </span><span class="post-icons"><span class="item-control blog-admin pid-58049851"><a title="Edit Post" href="http://www.blogger.com/post-edit.g?blogID=28492262&amp;postID=6041148199717041590"><img class="icon-action" src="http://www.blogger.com/img/icon18_edit_allbkg.gif" alt="" width="18" height="18" /><span style="color:#225588;"> </span></a></span></span></div>
<div class="post-footer-line post-footer-line-2"><span class="post-labels">Labels: <a rel="tag" href="http://vbadud.blogspot.com/search/label/Outlook%20VBA%20Extract%20Body%20content%20of%20Mails"><span style="color:#225588;">Outlook VBA Extract Body content of Mails</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Outlook%20VBA%20Extract%20Subject%20of%20Mails"><span style="color:#225588;">Outlook VBA Extract Subject of Mails</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Outlook%20VBA%20Mailitem"><span style="color:#225588;">Outlook VBA Mailitem</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Outlook%20VBA%20Subject%20property"><span style="color:#225588;">Outlook VBA Subject property</span></a> </span></div>
</div>
</div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vba2008.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vba2008.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vba2008.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vba2008.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vba2008.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vba2008.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vba2008.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vba2008.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vba2008.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vba2008.wordpress.com/68/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=68&subd=vba2008&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vba2008.wordpress.com/2008/10/17/extract-email-data-subject-body-programatically-using-outlook-vba/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de5fc3c7f573ab459e043ea3fc8e407a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vbadud</media:title>
		</media:content>

		<media:content url="http://www.blogger.com/img/icon18_edit_allbkg.gif" medium="image" />
	</item>
		<item>
		<title>Check Saved Status of Workbook using Excel VBA</title>
		<link>http://vba2008.wordpress.com/2008/10/17/check-saved-status-of-workbook-using-excel-vba/</link>
		<comments>http://vba2008.wordpress.com/2008/10/17/check-saved-status-of-workbook-using-excel-vba/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 06:02:16 +0000</pubDate>
		<dc:creator>vbadud</dc:creator>
				<category><![CDATA[Excel VBA]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[Check if a workbook is Saved using Excel VBA]]></category>
		<category><![CDATA[Excel VBA IsDirty Function]]></category>
		<category><![CDATA[Excel VBA Path property]]></category>
		<category><![CDATA[Excel VBA Saved property]]></category>

		<guid isPermaLink="false">http://vba2008.wordpress.com/?p=66</guid>
		<description><![CDATA[
Check If Workbook is Saved using Excel VBA

Use Saved property of Workbook to check the status. Saved returns True if no changes have been made to the specified workbook since it was last saved
Function IsDirty(ByRef OWB As Workbook) As Boolean
If OWB.Saved = False Then
IsDirty = True
End If
End Function
At times, the workbook would have been created [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=66&subd=vba2008&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="post hentry uncustomized-post-template"><a name="9139320624254734611"></a></p>
<h3 class="post-title entry-title"><a href="http://vbadud.blogspot.com/2008/04/check-if-workbook-is-saved-using-excel.html">Check If Workbook is Saved using Excel VBA</a></h3>
<div class="post-body entry-content">
<p>Use <span style="color:#ff0000;">Saved property of Workbook</span> to check the status. Saved returns True if no changes have been made to the specified workbook since it was last saved</p>
<p><span style="color:#3333ff;">Function IsDirty(ByRef OWB As Workbook) As Boolean</span></p>
<p><span style="color:#3333ff;">If OWB.Saved = False Then</span><br />
<span style="color:#3333ff;">IsDirty = True</span><br />
<span style="color:#3333ff;">End If</span></p>
<p><span style="color:#3333ff;">End Function</span></p>
<p>At times, the workbook would have been created and never saved. In that case, you can use the Path property to identify if it was saved at all</p>
<p><span style="color:#3333ff;">Function IsNeverSaved(ByRef OWB As Workbook) As Boolean</span></p>
<p><span style="color:#3333ff;">If OWB.Path = &#8220;&#8221; Then</span></p>
<p><span style="color:#3333ff;">IsNeverSaved = True</span><br />
<span style="color:#3333ff;">End If</span></p>
<p><span style="color:#3333ff;">End Function</span></div>
<div class="post-footer">
<div class="post-footer-line post-footer-line-1"><span class="post-author vcard">Posted by <span class="fn">Shasur</span> </span><span class="post-timestamp">at <a class="timestamp-link" title="permanent link" rel="bookmark" href="http://vbadud.blogspot.com/2008/04/check-if-workbook-is-saved-using-excel.html"><abbr class="published" title="00"><span style="color:#225588;">5:57 AM</span></abbr></a> </span><span class="post-icons"><span class="item-control blog-admin pid-58049851"><a title="Edit Post" href="http://www.blogger.com/post-edit.g?blogID=28492262&amp;postID=9139320624254734611"><img class="icon-action" src="http://www.blogger.com/img/icon18_edit_allbkg.gif" alt="" width="18" height="18" /><span style="color:#225588;"> </span></a></span></span></div>
<div class="post-footer-line post-footer-line-2"><span class="post-labels">Labels: <a rel="tag" href="http://vbadud.blogspot.com/search/label/Check%20if%20a%20workbook%20is%20Saved%20using%20Excel%20VBA"><span style="color:#225588;">Check if a workbook is Saved using Excel VBA</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Excel%20VBA%20IsDirty%20Function"><span style="color:#225588;">Excel VBA IsDirty Function</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Excel%20VBA%20Path%20property"><span style="color:#225588;">Excel VBA Path property</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Excel%20VBA%20Saved%20property"><span style="color:#225588;">Excel VBA Saved property</span></a> </span></div>
</div>
</div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vba2008.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vba2008.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vba2008.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vba2008.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vba2008.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vba2008.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vba2008.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vba2008.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vba2008.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vba2008.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=66&subd=vba2008&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vba2008.wordpress.com/2008/10/17/check-saved-status-of-workbook-using-excel-vba/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de5fc3c7f573ab459e043ea3fc8e407a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vbadud</media:title>
		</media:content>

		<media:content url="http://www.blogger.com/img/icon18_edit_allbkg.gif" medium="image" />
	</item>
		<item>
		<title>Check Version of Browser using Excel VBA</title>
		<link>http://vba2008.wordpress.com/2008/10/17/check-version-of-browser-using-excel-vba/</link>
		<comments>http://vba2008.wordpress.com/2008/10/17/check-version-of-browser-using-excel-vba/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 06:01:54 +0000</pubDate>
		<dc:creator>vbadud</dc:creator>
				<category><![CDATA[Excel VBA]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[Word VBA]]></category>

		<guid isPermaLink="false">http://vba2008.wordpress.com/?p=64</guid>
		<description><![CDATA[
Identify Browser Version using Excel VBA

The following code can be used to check the version of Internet Explorer or Netscape Navigator (whichever is the default browser):
Sub CheckWebOptions()
Dim wkbOne As Workbook
Set wkbOne = Application.Workbooks(1)
&#8216; Determine if IE5 is the target browser.
If wkbOne.WebOptions.TargetBrowser = msoTargetBrowserIE6 Then
MsgBox &#8220;The target browser is IE6 or later.&#8221;
ElseIf wkbOne.WebOptions.TargetBrowser = msoTargetBrowserIE5 Then
MsgBox [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=64&subd=vba2008&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="post hentry uncustomized-post-template"><a name="6900429931669191547"></a></p>
<h3 class="post-title entry-title"><a href="http://vbadud.blogspot.com/2008/04/identify-browser-version-using-excel.html">Identify Browser Version using Excel VBA</a></h3>
<div class="post-body entry-content">
<p>The following code can be used to <span style="color:#ff0000;">check the version of Internet Explorer </span>or Netscape Navigator (whichever is the default browser):</p>
<p><span style="color:#3333ff;">Sub CheckWebOptions()</span></p>
<p><span style="color:#3333ff;">Dim wkbOne As Workbook</span></p>
<p><span style="color:#3333ff;">Set wkbOne = Application.Workbooks(1)</span></p>
<p><span style="color:#3333ff;">&#8216; Determine if IE5 is the target browser.</span><br />
<span style="color:#3333ff;">If wkbOne.WebOptions.TargetBrowser = msoTargetBrowserIE6 Then</span><br />
<span style="color:#3333ff;">MsgBox &#8220;The target browser is IE6 or later.&#8221;</span><br />
<span style="color:#3333ff;">ElseIf wkbOne.WebOptions.TargetBrowser = msoTargetBrowserIE5 Then</span><br />
<span style="color:#3333ff;">MsgBox &#8220;The target browser is IE5 or later.&#8221;</span><br />
<span style="color:#3333ff;">ElseIf wkbOne.WebOptions.TargetBrowser = msoTargetBrowserIE4 Then</span><br />
<span style="color:#3333ff;">MsgBox &#8220;The target browser is IE4 or later.&#8221;</span><br />
<span style="color:#3333ff;">ElseIf wkbOne.WebOptions.TargetBrowser = msoTargetBrowserV4 Then</span><br />
<span style="color:#3333ff;">MsgBox &#8220;Microsoft Internet Explorer 4.0, Netscape Navigator 4.0, or later.&#8221;</span><br />
<span style="color:#3333ff;">ElseIf wkbOne.WebOptions.TargetBrowser = msoTargetBrowserV3 Then</span><br />
<span style="color:#3333ff;">MsgBox &#8220;Microsoft Internet Explorer 3.0, Netscape Navigator 3.0, or later.&#8221;</span><br />
<span style="color:#3333ff;">Else</span><br />
<span style="color:#3333ff;">MsgBox &#8220;The target browser is not in the given list&#8221;</span><br />
<span style="color:#3333ff;">End If</span></p>
<p><span style="color:#3333ff;">End Sub</span></div>
<div class="post-footer">
<div class="post-footer-line post-footer-line-1"><span class="post-author vcard">Posted by <span class="fn">Shasur</span> </span><span class="post-timestamp">at <a class="timestamp-link" title="permanent link" rel="bookmark" href="http://vbadud.blogspot.com/2008/04/identify-browser-version-using-excel.html"><abbr class="published" title="00"><span style="color:#225588;">6:01 AM</span></abbr></a> </span><span class="post-icons"><span class="item-control blog-admin pid-58049851"><a title="Edit Post" href="http://www.blogger.com/post-edit.g?blogID=28492262&amp;postID=6900429931669191547"><img class="icon-action" src="http://www.blogger.com/img/icon18_edit_allbkg.gif" alt="" width="18" height="18" /><span style="color:#225588;"> </span></a></span></span></div>
<div class="post-footer-line post-footer-line-2"><span class="post-labels">Labels: <a rel="tag" href="http://vbadud.blogspot.com/search/label/Excel%20VBA%20WebOptions"><span style="color:#225588;">Excel VBA WebOptions</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Identify%20Browser%20Version%20using%20Excel%20VBA"><span style="color:#225588;">Identify Browser Version using Excel VBA</span></a> </span></div>
</div>
</div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vba2008.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vba2008.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vba2008.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vba2008.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vba2008.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vba2008.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vba2008.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vba2008.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vba2008.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vba2008.wordpress.com/64/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=64&subd=vba2008&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vba2008.wordpress.com/2008/10/17/check-version-of-browser-using-excel-vba/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de5fc3c7f573ab459e043ea3fc8e407a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vbadud</media:title>
		</media:content>

		<media:content url="http://www.blogger.com/img/icon18_edit_allbkg.gif" medium="image" />
	</item>
		<item>
		<title>Using Vb.Net Function in VBA</title>
		<link>http://vba2008.wordpress.com/2008/10/17/using-vbnet-function-in-vba/</link>
		<comments>http://vba2008.wordpress.com/2008/10/17/using-vbnet-function-in-vba/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 06:01:27 +0000</pubDate>
		<dc:creator>vbadud</dc:creator>
				<category><![CDATA[Excel VBA]]></category>
		<category><![CDATA[VB SCript]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[Vb.NET]]></category>

		<guid isPermaLink="false">http://vba2008.wordpress.com/?p=62</guid>
		<description><![CDATA[
How to use .Net Array.Sort Function in VBA

Using Vb.Net Function in VBA






How to use a VB.Net DLL/TLB in Excel VBA
Here is an example for using the customized .NET Function in Excel VBA. Unfortunately EXcel VBA doesn&#8217;t have a Array.Sort function. To overcome the shortcomings, we create our own function here in .Net and use the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=62&subd=vba2008&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="post hentry uncustomized-post-template"><a name="8723424639023317768"></a></p>
<h3 class="post-title entry-title"><a href="http://vbadud.blogspot.com/2008/04/how-to-use-net-arraysort-function-in.html">How to use .Net Array.Sort Function in VBA</a></h3>
<div class="post-body entry-content">
<h3 class="post-title entry-title"><a href="http://dotnetdud.blogspot.com/2008/04/using-vbnet-function-in-vba.html">Using Vb.Net Function in VBA</a></h3>
<div class="post-body entry-content">
<p><a href="http://bp3.blogger.com/_s2jU7girbyM/SBR_qqef-SI/AAAAAAAAAZM/vmh8cfVy9s4/s1600-h/DND_SortArray1.JPG"><img style="float:right;cursor:pointer;margin:0 0 10px 10px;" src="http://bp3.blogger.com/_s2jU7girbyM/SBR_qqef-SI/AAAAAAAAAZM/vmh8cfVy9s4/s400/DND_SortArray1.JPG" border="0" alt="" /></a><br />
<a href="http://bp0.blogger.com/_s2jU7girbyM/SBR_q6ef-TI/AAAAAAAAAZU/IqfPVCjKUro/s1600-h/DND_SortArray2.JPG"><img style="float:right;cursor:pointer;margin:0 0 10px 10px;" src="http://bp0.blogger.com/_s2jU7girbyM/SBR_q6ef-TI/AAAAAAAAAZU/IqfPVCjKUro/s400/DND_SortArray2.JPG" border="0" alt="" /></a><br />
<a href="http://bp2.blogger.com/_s2jU7girbyM/SBR_raef-UI/AAAAAAAAAZc/p7ni_4ZLGIg/s1600-h/DND_SortArray3.JPG"><img style="float:right;cursor:pointer;margin:0 0 10px 10px;" src="http://bp2.blogger.com/_s2jU7girbyM/SBR_raef-UI/AAAAAAAAAZc/p7ni_4ZLGIg/s400/DND_SortArray3.JPG" border="0" alt="" /></a><br />
<a href="http://bp2.blogger.com/_s2jU7girbyM/SBR_raef-VI/AAAAAAAAAZk/5JLTVbHcp_Y/s1600-h/DND_SortArray4.JPG"><img style="float:right;cursor:pointer;margin:0 0 10px 10px;" src="http://bp2.blogger.com/_s2jU7girbyM/SBR_raef-VI/AAAAAAAAAZk/5JLTVbHcp_Y/s400/DND_SortArray4.JPG" border="0" alt="" /></a><br />
<a href="http://bp0.blogger.com/_s2jU7girbyM/SBR_r6ef-WI/AAAAAAAAAZs/WBhrPiERa9A/s1600-h/DND_SortArray5.JPG"><img style="float:right;cursor:pointer;margin:0 0 10px 10px;" src="http://bp0.blogger.com/_s2jU7girbyM/SBR_r6ef-WI/AAAAAAAAAZs/WBhrPiERa9A/s400/DND_SortArray5.JPG" border="0" alt="" /></a></p>
<p><span style="font-weight:bold;color:#ff6600;">How to use a VB.Net </span><span style="font-weight:bold;color:#ff6600;">DLL/T</span><span style="font-weight:bold;color:#ff6600;">LB in Excel VBA</p>
<p><span style="color:#993300;">Here is an example for using the customized .NET Function in Excel VBA. Unfortunately EXcel VBA doesn&#8217;t have a Array.Sort function. To overcome the shortcomings, we create our own function here in .Net and use the same in Excel VBA</span></p>
<p>Here are the steps:</p>
<p></span></p>
<ol>
<li><span style="font-weight:bold;color:#ff6600;">Create a class library project in Visual Studio</span></li>
<li>Add a COM Class item (DND_SortArray in this example)</li>
<li>In the assembly information edit the title, company and provide a meaningful description. This would be seen in the References dialog in Excel</li>
<li>Add the code shown below:</li>
</ol>
<p><span style="font-size:10pt;font-family:'Courier New';">_</span></p>
<ol>
<li>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:#0000ff;font-family:'Courier New';">Public</span><span style="font-size:10pt;font-family:'Courier New';"> <span style="color:#0000ff;">Class</span> DotNetDud_SortArray</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:#0000ff;font-family:'Courier New';">#Region</span><span style="font-size:10pt;font-family:'Courier New';"> <span style="color:#a31515;">&#8220;COM GUIDs&#8221;</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"><span style="color:#008000;">&#8216; These<span> </span>GUIDs provide the COM identity for this class </span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"><span style="color:#008000;">&#8216; and its COM interfaces. If you change them, existing </span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"><span style="color:#008000;">&#8216; clients will no longer be able to access the class.</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"><span style="color:#0000ff;">Public</span> <span style="color:#0000ff;">Const</span> ClassId <span style="color:#0000ff;">As</span> <span style="color:#0000ff;">String</span> = <span style="color:#a31515;">&#8220;93534c94-9fc1-4a54-b022-338fa7d454c1&#8243;</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"><span style="color:#0000ff;">Public</span> <span style="color:#0000ff;">Const</span> InterfaceId <span style="color:#0000ff;">As</span> <span style="color:#0000ff;">String</span> = <span style="color:#a31515;">&#8220;03787ed3-bc65-41a1-9053-d37f390ff94b&#8221;</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"><span style="color:#0000ff;">Public</span> <span style="color:#0000ff;">Const</span> EventsId <span style="color:#0000ff;">As</span> <span style="color:#0000ff;">String</span> = <span style="color:#a31515;">&#8220;34d12c14-8afd-44b7-a987-fc2f909724b6&#8243;</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:#0000ff;font-family:'Courier New';">#End</span><span style="font-size:10pt;font-family:'Courier New';"> <span style="color:#0000ff;">Region</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:#0000ff;font-family:'Courier New';"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"><span style="color:#008000;">&#8216; A creatable COM class must have a Public Sub New() </span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"><span style="color:#008000;">&#8216; with no parameters, otherwise, the class will not be </span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"><span style="color:#008000;">&#8216; registered in the COM registry and cannot be created </span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"><span style="color:#008000;">&#8216; via CreateObject.</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"><span style="color:#0000ff;">Public</span> <span style="color:#0000ff;">Sub</span> <span style="color:#0000ff;">New</span>()</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"><span style="color:#0000ff;">MyBase</span>.New()</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"><span style="color:#0000ff;">End</span> <span style="color:#0000ff;">Sub</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:#0000ff;font-family:'Courier New';"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"><span style="color:#0000ff;">Public</span> <span style="color:#0000ff;">Sub</span> SortArray(<span style="color:#0000ff;">ByRef</span> arTemp() <span style="color:#0000ff;">As</span> <span style="color:#0000ff;">String</span>)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';">Array.Sort(arTemp)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';"><span style="color:#0000ff;">End</span> <span style="color:#0000ff;">Sub</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:#0000ff;font-family:'Courier New';">End</span><span style="font-size:10pt;font-family:'Courier New';"> <span style="color:#0000ff;">Class</span></span></p>
</li>
</ol>
<p>Compile the Project. You will get a DLL and a TLB.</p>
<p>Now open the <a id="KonaLink0" class="kLink" href="http://dotnetdud.blogspot.com/#" target="_top"><span style="font-weight:400;font-size:12px;color:#0000ff;font-family:'Trebuchet MS',Verdana,Arial,Sans-serif;position:static;"><span class="kLink" style="font-weight:400;font-size:12px;color:#0000ff;font-family:'Trebuchet MS',Verdana,Arial,Sans-serif;position:static;">Excel </span><span class="kLink" style="font-weight:400;font-size:12px;color:#0000ff;font-family:'Trebuchet MS',Verdana,Arial,Sans-serif;position:static;">VBA</span></span></a> Editor and add the TLB file to References.</p>
<p>The following code will now use the SortArray .NET Function created</p>
<p class="MsoNormal"><span lang="EN-IN">Sub Use_DotNet_Sort()</span></p>
<p class="MsoNormal" style="margin-left:.5in;line-height:normal;"><span lang="EN-IN">Dim Cls1 As DotNetDud_SortArray.DotNetDud_SortArray</span></p>
<p class="MsoNormal" style="margin-left:.5in;line-height:normal;"><span lang="EN-IN">Set Cls1 = New DotNetDud_SortArray.DotNetDud_SortArray</span></p>
<p class="MsoNormal" style="margin-left:.5in;line-height:normal;"><span lang="EN-IN">Dim arTemp(0 To 2) As String</span></p>
<p class="MsoNormal" style="margin-left:.5in;line-height:normal;"><span lang="EN-IN">arTemp(0) = &#8220;Bottle&#8221;</span></p>
<p class="MsoNormal" style="margin-left:.5in;line-height:normal;"><span lang="EN-IN">arTemp(1) = &#8220;Apple&#8221;</span></p>
<p class="MsoNormal" style="margin-left:.5in;line-height:normal;"><span lang="EN-IN">arTemp(2) = &#8220;Aaron&#8221;</span></p>
<p class="MsoNormal" style="margin-left:.5in;line-height:normal;"><span lang="EN-IN">Cls1.SortArray arTemp</span></p>
<p class="MsoNormal" style="margin-left:.5in;line-height:normal;"><span lang="EN-IN">Set Cls1 = Nothing</span></p>
<p class="MsoNormal"><span lang="EN-IN">End Sub</span></p>
<ol>
<li><a href="http://bp3.blogger.com/_s2jU7girbyM/SBR_Uqef-RI/AAAAAAAAAZE/Idv5vgRwXYw/s1600-h/DND_SortArray6.JPG"><img style="float:right;cursor:pointer;margin:0 0 10px 10px;" src="http://bp3.blogger.com/_s2jU7girbyM/SBR_Uqef-RI/AAAAAAAAAZE/Idv5vgRwXYw/s400/DND_SortArray6.JPG" border="0" alt="" /></a><a href="http://bp1.blogger.com/_s2jU7girbyM/SBR_UKef-QI/AAAAAAAAAY8/fp49caZwU7Q/s1600-h/DND_SortArray7.JPG"><img style="float:right;cursor:pointer;margin:0 0 10px 10px;" src="http://bp1.blogger.com/_s2jU7girbyM/SBR_UKef-QI/AAAAAAAAAY8/fp49caZwU7Q/s400/DND_SortArray7.JPG" border="0" alt="" /></a></li>
</ol>
</div>
<div class="post-footer-line post-footer-line-1"><span class="post-author vcard">Posted by <span class="fn">Shasur</span> </span><span class="post-timestamp">at <a class="timestamp-link" title="permanent link" rel="bookmark" href="http://dotnetdud.blogspot.com/2008/04/using-vbnet-function-in-vba.html"><abbr class="published" title="00"><span style="color:#225588;">6:26 AM</span></abbr></a> </span><span class="post-comment-link"><a class="comment-link" href="http://vba2008.wordpress.com/wp-admin/comment.g?blogID=6497434045878013201&amp;postID=4683028290389008867"><span style="color:#225588;">0 comments</span></a> </span><span class="post-icons"><span class="item-control blog-admin pid-24239361"><a title="Edit Post" href="http://vba2008.wordpress.com/wp-admin/post-edit.g?blogID=6497434045878013201&amp;postID=4683028290389008867"><img class="icon-action" src="http://vba2008.wordpress.com/wp-admin/img/icon18_edit_allbkg.gif" alt="" /><span style="color:#225588;"> </span></a></span></span></div>
<div class="post-footer-line post-footer-line-2"><span class="post-labels">Label<span style="font-weight:bold;color:#ff0000;">s: </span><a rel="tag" href="http://dotnetdud.blogspot.com/search/label/Array.Sort%20function%20in%20Excel%20VBA.%20Using%20.Net%20DLLs%20in%20Excel%20VBA">Array.Sort function in Excel VBA. Using .Net DLLs in Excel VBA</a><span style="font-weight:bold;color:#ff0000;">, </span><a rel="tag" href="http://dotnetdud.blogspot.com/search/label/How%20to%20call%20a%20.NET%20DLL%20from%20VBA.%20How%20to%20call%20a%20VB.Net%20Function%20from%20Excel%20VBA%2FWord%20VBA">How to call a .NET DLL from VBA. How to call a VB.Net Function from Excel VBA/Word VBA</a> </span></div>
</div>
<div class="post-footer">
<div class="post-footer-line post-footer-line-1"><span class="post-author vcard">Posted by <span class="fn">Shasur</span> </span><span class="post-timestamp">at <a class="timestamp-link" title="permanent link" rel="bookmark" href="http://vbadud.blogspot.com/2008/04/how-to-use-net-arraysort-function-in.html"><abbr class="published" title="00"><span style="color:#225588;">6:43 AM</span></abbr></a> </span><span class="post-icons"><span class="item-control blog-admin pid-58049851"><a title="Edit Post" href="http://www.blogger.com/post-edit.g?blogID=28492262&amp;postID=8723424639023317768"><img class="icon-action" src="http://www.blogger.com/img/icon18_edit_allbkg.gif" alt="" width="18" height="18" /><span style="color:#225588;"> </span></a></span></span></div>
<div class="post-footer-line post-footer-line-2"><span class="post-labels">Labels: <a rel="tag" href="http://vbadud.blogspot.com/search/label/Array.Sort%20function%20in%20Excel%20VBA.%20How%20to%20sort%20an%20Array%20in%20VBA.%20VBA%20Array%20Sort%20Function"><span style="color:#225588;">Array.Sort function in Excel VBA. How to sort an Array in VBA. VBA Array Sort Function</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Use%20Visual%20Basic%20.NET%20or%20C%23%20Functions%20in%20VBA"><span style="color:#225588;">Use Visual Basic .NET or C# Functions in VBA</span></a> </span></div>
</div>
</div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vba2008.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vba2008.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vba2008.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vba2008.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vba2008.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vba2008.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vba2008.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vba2008.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vba2008.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vba2008.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=62&subd=vba2008&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vba2008.wordpress.com/2008/10/17/using-vbnet-function-in-vba/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de5fc3c7f573ab459e043ea3fc8e407a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vbadud</media:title>
		</media:content>

		<media:content url="http://bp3.blogger.com/_s2jU7girbyM/SBR_qqef-SI/AAAAAAAAAZM/vmh8cfVy9s4/s400/DND_SortArray1.JPG" medium="image" />

		<media:content url="http://bp0.blogger.com/_s2jU7girbyM/SBR_q6ef-TI/AAAAAAAAAZU/IqfPVCjKUro/s400/DND_SortArray2.JPG" medium="image" />

		<media:content url="http://bp2.blogger.com/_s2jU7girbyM/SBR_raef-UI/AAAAAAAAAZc/p7ni_4ZLGIg/s400/DND_SortArray3.JPG" medium="image" />

		<media:content url="http://bp2.blogger.com/_s2jU7girbyM/SBR_raef-VI/AAAAAAAAAZk/5JLTVbHcp_Y/s400/DND_SortArray4.JPG" medium="image" />

		<media:content url="http://bp0.blogger.com/_s2jU7girbyM/SBR_r6ef-WI/AAAAAAAAAZs/WBhrPiERa9A/s400/DND_SortArray5.JPG" medium="image" />

		<media:content url="http://bp3.blogger.com/_s2jU7girbyM/SBR_Uqef-RI/AAAAAAAAAZE/Idv5vgRwXYw/s400/DND_SortArray6.JPG" medium="image" />

		<media:content url="http://bp1.blogger.com/_s2jU7girbyM/SBR_UKef-QI/AAAAAAAAAY8/fp49caZwU7Q/s400/DND_SortArray7.JPG" medium="image" />

		<media:content url="http://vba2008.wordpress.com/wp-admin/img/icon18_edit_allbkg.gif" medium="image" />

		<media:content url="http://www.blogger.com/img/icon18_edit_allbkg.gif" medium="image" />
	</item>
		<item>
		<title>Add Hidden Data using StorageItem in Outlook VBA</title>
		<link>http://vba2008.wordpress.com/2008/10/17/add-hidden-data-using-storageitem-in-outlook-vba/</link>
		<comments>http://vba2008.wordpress.com/2008/10/17/add-hidden-data-using-storageitem-in-outlook-vba/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 06:00:54 +0000</pubDate>
		<dc:creator>vbadud</dc:creator>
				<category><![CDATA[Outlook VBA]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://vba2008.wordpress.com/?p=60</guid>
		<description><![CDATA[
Document Variables in Outlook using VBA

There are multiple ways to have a template in Outlook for achieving tasks. Sometimes, you will require to hold some document variable in outlook like you do with Microsoft Word. The following example shows a simple way to add some text in drafts folder. This will not be visible to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=60&subd=vba2008&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="post hentry uncustomized-post-template"><a name="3078811669291561845"></a></p>
<h3 class="post-title entry-title"><a href="http://vbadud.blogspot.com/2008/04/document-variables-in-outlook-using-vba.html">Document Variables in Outlook using VBA</a></h3>
<div class="post-body entry-content">
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><strong><span lang="EN-IN">There are multiple ways to have a template in Outlook for achieving tasks. Sometimes, you will require to hold some document variable in outlook like you do with Microsoft Word. The following example shows a simple way to add some text in drafts folder. This will not be visible to user.</span></strong></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><strong><span lang="EN-IN"></span></strong></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Sub</span> Create_Hidden_Data()</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Dim</span> oNs <span style="color:blue;">As</span> Outlook.NameSpace</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Dim</span> oFld <span style="color:blue;">As</span> Outlook.Folder</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Dim</span> oSItem <span style="color:blue;">As</span> Outlook.StorageItem</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">On</span> <span style="color:blue;">Error</span> <span style="color:blue;">GoTo</span> OL_Error</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oNs = Application.GetNamespace(<span style="color:#a31515;">&#8220;MAPI&#8221;</span>)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oFld = oNs.GetDefaultFolder(olFolderDrafts)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oSItem = oFld.GetStorage(<span style="color:#a31515;">&#8220;My Appt Template&#8221;</span>, olIdentifyBySubject)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oSItem.UserProperties.Add(<span style="color:#a31515;">&#8220;My Footer&#8221;</span>, olText)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oSItem.UserProperties(<span style="color:#a31515;">&#8220;My Footer&#8221;</span>).Value = <span style="color:#a31515;">&#8220;VBADud &#8211; Samples &amp; Tips on VBA&#8221;</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oSItem.UserProperties.Add(<span style="color:#a31515;">&#8220;My Body&#8221;</span>, olText)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oSItem.UserProperties(<span style="color:#a31515;">&#8220;My Body&#8221;</span>).Value = <span style="color:#a31515;">&#8220;Hi&#8221;</span> &amp; vbCrLf &amp; <span style="color:#a31515;">&#8220;Requesting a appointment with you for discussing&#8230;&#8221;</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oSItem.Save()</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Exit</span> <span style="color:blue;">Sub</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">OL_Error:</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">MsgBox(Err.Description)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">Err.Clear()</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">End</span> <span style="color:blue;">Sub</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:blue;font-family:'Courier New';" lang="EN-IN"><span style="font-weight:bold;color:#ff6600;">The Properties are stored in Drafts Folder and can be retrieved using the following code</span><br />
</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Sub</span> GetData_From_StorageItem()</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Dim</span> oNs <span style="color:blue;">As</span> Outlook.NameSpace</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Dim</span> oFL <span style="color:blue;">As</span> Outlook.Folder</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Dim</span> oItem <span style="color:blue;">As</span> Outlook.StorageItem</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">On</span> <span style="color:blue;">Error</span> <span style="color:blue;">GoTo</span> OL_Error</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oNs = Application.GetNamespace(<span style="color:#a31515;">&#8220;MAPI&#8221;</span>)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oFld = oNs.GetDefaultFolder(olFolderDrafts)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oItem = oFld.GetStorage(<span style="color:#a31515;">&#8220;My Appt Template&#8221;</span>, olIdentifyBySubject)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">If</span> oItem.Size &lt;&gt; 0 <span style="color:blue;">Then</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">MsgBox(oItem.UserProperties(<span style="color:#a31515;">&#8220;My Footer&#8221;</span>))</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">MsgBox(oItem.UserProperties(<span style="color:#a31515;">&#8220;My Body&#8221;</span>))</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">End</span> <span style="color:blue;">If</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:blue;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Exit</span> <span style="color:blue;">Sub</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">OL_Error:</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">MsgBox(Err.Description)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">Err.Clear()</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">End</span> <span style="color:blue;">Sub</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:blue;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216;<span style="font-weight:bold;color:#ff0000;">StorageItem is a message object in MAPI</span> that is always saved as a hidden item in the parent folder and stores private data for Outlook solutions.</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216;</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216;A StorageItem object is stored at the folder level, allowing it to roam with the account and be available online or offline.</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216;</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216;The Outlook object model does not provide any collection object for StorageItem objects. However, you can use Folder.GetTable to obtain a Table with all the hidden items in a Folder, when you specify the TableContents parameter as olHiddenItems. If keeping your data private is of a high concern, you should encrypt the data before storing it.</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216;</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216;Once you have obtained a StorageItem object, you can do the following to store solution data:</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216;</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216;Add attachments to the item for storage.</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216;Use explicit built-in properties of the item such as Body to store custom data.</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216;Add custom properties to the item using UserProperties.Add method. Note that in this case, the optional AddToFolderFields and DisplayFormat arguments of the UserProperties.Add method will be ignored.</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216;Use the PropertyAccessor object to get or set custom properties.</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216;</span></span></p>
<p><span style="font-size:10pt;line-height:115%;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216;The default message class for a new StorageItem is IPM.Storage. If the StorageItem existed as a hidden message in a version of Outlook prior to <span style="font-weight:bold;color:#ff0000;">Microsoft Office Outlook 2007</span>, the message class will remain unchanged. In order to prevent modification of the message class, StorageItem does not expose an explicit MessageClass property.</span></span></div>
<div class="post-footer">
<div class="post-footer-line post-footer-line-1"><span class="post-author vcard">Posted by <span class="fn">Shasur</span> </span><span class="post-timestamp">at <a class="timestamp-link" title="permanent link" rel="bookmark" href="http://vbadud.blogspot.com/2008/04/document-variables-in-outlook-using-vba.html"><abbr class="published" title="00"><span style="color:#225588;">8:40 AM</span></abbr></a> </span><span class="post-icons"><span class="item-control blog-admin pid-58049851"><a title="Edit Post" href="http://www.blogger.com/post-edit.g?blogID=28492262&amp;postID=3078811669291561845"><img class="icon-action" src="http://www.blogger.com/img/icon18_edit_allbkg.gif" alt="" width="18" height="18" /><span style="color:#225588;"> </span></a></span></span></div>
<div class="post-footer-line post-footer-line-2"><span class="post-labels">Labels: <a rel="tag" href="http://vbadud.blogspot.com/search/label/Outlook%20VBA"><span style="color:#225588;">Outlook VBA</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Outlook%20VBA%20GetTable%20MEthod"><span style="color:#225588;">Outlook VBA GetTable MEthod</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Outlook%20VBA%20StorageItem%20object"><span style="color:#225588;">Outlook VBA StorageItem object</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Outlook%20VBA%20Store%20Hidden%20Data"><span style="color:#225588;">Outlook VBA Store Hidden Data</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Outlook%20VBA%20Templates"><span style="color:#225588;">Outlook VBA Templates</span></a> </span></div>
</div>
</div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vba2008.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vba2008.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vba2008.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vba2008.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vba2008.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vba2008.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vba2008.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vba2008.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vba2008.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vba2008.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=60&subd=vba2008&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vba2008.wordpress.com/2008/10/17/add-hidden-data-using-storageitem-in-outlook-vba/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de5fc3c7f573ab459e043ea3fc8e407a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vbadud</media:title>
		</media:content>

		<media:content url="http://www.blogger.com/img/icon18_edit_allbkg.gif" medium="image" />
	</item>
		<item>
		<title>Adding an OLE Object (Command Button) to a Worksheet using Excel VBA</title>
		<link>http://vba2008.wordpress.com/2008/10/17/adding-an-ole-object-command-button-to-a-worksheet-using-excel-vba/</link>
		<comments>http://vba2008.wordpress.com/2008/10/17/adding-an-ole-object-command-button-to-a-worksheet-using-excel-vba/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 06:00:13 +0000</pubDate>
		<dc:creator>vbadud</dc:creator>
				<category><![CDATA[Excel VBA]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[Add command button to worksheet using VBA]]></category>
		<category><![CDATA[Creating a Command Button on Sheet using Excel VBA]]></category>
		<category><![CDATA[Excel VBA add ActiveX control]]></category>
		<category><![CDATA[Excel VBA add OLEObject object]]></category>

		<guid isPermaLink="false">http://vba2008.wordpress.com/?p=58</guid>
		<description><![CDATA[
Creating a Command Button on Sheet using Excel VBA



Sub Create_Command_Button_2007()
&#8216;
&#8216; Creates a Command button and Positions it
&#8216; Written by Shasur for http://vbadud.blogspot.com


Dim oOLE As OLEObject

&#8216; Add a Command Button
oOLE = ActiveSheet.OLEObjects.Add(ClassType:=&#8220;Forms.CommandButton.1&#8243;, Left:=220, Top:=40, Height:=30, Width:=120)


oOLE.Interior.Color = vbRed

&#8216; Move and Size with cells
oOLE.Placement = XlPlacement.xlMoveAndSize

oOLE.Object.Caption = &#8220;Click Me&#8230;&#8221;

End Sub

Each OLEObject object represents an ActiveX control or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=58&subd=vba2008&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="post hentry uncustomized-post-template"><a name="7259495045246979819"></a></p>
<h3 class="post-title entry-title"><a href="http://vbadud.blogspot.com/2008/05/creating-command-button-on-sheet-using.html">Creating a Command Button on Sheet using Excel VBA</a></h3>
<div class="post-body entry-content">
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:blue;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:blue;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:blue;font-family:'Courier New';" lang="EN-IN">Sub</span><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"> Create_Command_Button_2007()</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216;</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216; Creates a Command button and Positions it</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216; Written by Shasur for http://vbadud.blogspot.com</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:green;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:green;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Dim</span> oOLE <span style="color:blue;">As</span> OLEObject</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216; Add a Command Button</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oOLE = ActiveSheet.OLEObjects.Add(ClassType:=<span style="color:#a31515;">&#8220;Forms.CommandButton.1&#8243;</span>, Left:=220, Top:=40, Height:=30, Width:=120)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oOLE.Interior.Color = vbRed</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:green;">&#8216; Move and Size with cells</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oOLE.Placement = XlPlacement.xlMoveAndSize</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oOLE.Object.Caption = <span style="color:#a31515;">&#8220;Click Me&#8230;&#8221;</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:#a31515;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:blue;font-family:'Courier New';" lang="EN-IN">End</span><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"> <span style="color:blue;">Sub</span></span></p>
<p class="MsoNormal"><span lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:.1in;line-height:normal;"><span style="font-size:8.5pt;font-family:Tahoma;" lang="EN-IN">Each <strong>OLEObject</strong> object represents an ActiveX control or a linked or embedded OLE object.</span></p>
<p class="MsoNormal" style="margin-top:.1in;line-height:normal;"><span style="font-size:8.5pt;font-family:Tahoma;" lang="EN-IN">An ActiveX control on a sheet has two names: the name of the shape that contains the control, which you can see in the <strong>Name</strong> box when you view the sheet, and the code name for the control, which you can see in the cell to the right of <strong>(Name)</strong> in the <strong>Properties</strong> window. When you first add a control to a sheet, the shape name and code name match. However, if you change either the shape name or code name, the other is not automatically changed to match.</span></p>
</div>
<div class="post-footer">
<div class="post-footer-line post-footer-line-1"><span class="post-author vcard">Posted by <span class="fn">Shasur</span> </span><span class="post-timestamp">at <a class="timestamp-link" title="permanent link" rel="bookmark" href="http://vbadud.blogspot.com/2008/05/creating-command-button-on-sheet-using.html"><abbr class="published" title="00"><span style="color:#225588;">2:09 AM</span></abbr></a> </span><span class="post-icons"><span class="item-control blog-admin pid-58049851"><a title="Edit Post" href="http://www.blogger.com/post-edit.g?blogID=28492262&amp;postID=7259495045246979819"><img class="icon-action" src="http://www.blogger.com/img/icon18_edit_allbkg.gif" alt="" width="18" height="18" /><span style="color:#225588;"> </span></a></span></span></div>
<div class="post-footer-line post-footer-line-2"><span class="post-labels">Labels: <a rel="tag" href="http://vbadud.blogspot.com/search/label/Add%20command%20button%20to%20worksheet%20using%20VBA"><span style="color:#225588;">Add command button to worksheet using VBA</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Creating%20a%20Command%20Button%20on%20Sheet%20using%20Excel%20VBA"><span style="color:#225588;">Creating a Command Button on Sheet using Excel VBA</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Excel%20VBA%20add%20%20ActiveX%20control"><span style="color:#225588;">Excel VBA add ActiveX control</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Excel%20VBA%20add%20OLEObject%20object"><span style="color:#225588;">Excel VBA add OLEObject object</span></a> </span></div>
</div>
</div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vba2008.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vba2008.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vba2008.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vba2008.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vba2008.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vba2008.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vba2008.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vba2008.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vba2008.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vba2008.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=58&subd=vba2008&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vba2008.wordpress.com/2008/10/17/adding-an-ole-object-command-button-to-a-worksheet-using-excel-vba/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de5fc3c7f573ab459e043ea3fc8e407a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vbadud</media:title>
		</media:content>

		<media:content url="http://www.blogger.com/img/icon18_edit_allbkg.gif" medium="image" />
	</item>
		<item>
		<title>Macro to Create a Pivot Table from Existing Pivot Cache</title>
		<link>http://vba2008.wordpress.com/2008/10/17/macro-to-create-a-pivot-table-from-existing-pivot-cache/</link>
		<comments>http://vba2008.wordpress.com/2008/10/17/macro-to-create-a-pivot-table-from-existing-pivot-cache/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 05:59:30 +0000</pubDate>
		<dc:creator>vbadud</dc:creator>
				<category><![CDATA[Excel VBA]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://vba2008.wordpress.com/?p=56</guid>
		<description><![CDATA[
Create Additional Pivot Table using Excel VBA (from Existing PivotCache)


Many times you will have a Pivot Table created from a pivot cache and you have a requirment to create another pivot table from the same data. In such cases, instead of creating a new cache, you can use the existing pivot cache to create another [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=56&subd=vba2008&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="post hentry uncustomized-post-template"><a name="1283303684811496941"></a></p>
<h3 class="post-title entry-title"><a href="http://vbadud.blogspot.com/2008/05/create-additional-pivot-table-using.html">Create Additional Pivot Table using Excel VBA (from Existing PivotCache)</a></h3>
<div class="post-body entry-content">
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN">Many times you wi</span><span lang="EN-IN">ll ha</span><span lang="EN-IN">ve a Pivot Table created from a pivot cache and you have a requirment to create another pivot table from the same data. In such cases, instead of creating a new cache, you can use the existing pivot cache to create anot</span><span lang="EN-IN">her pivot table. This will save a good amount of memory too.</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN">Sub</span><span lang="EN-IN"> Create_Pivot_Table_From_Existing_Cache()</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN"><span style="color:blue;">Dim</span> oPC <span style="color:blue;">As</span> PivotCache</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN"><span style="color:blue;">Dim</span> oPT <span style="color:blue;">As</span> PivotTable</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN"><span style="color:blue;">Dim</span> oWS <span style="color:blue;">As</span> Worksheet</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN">oWS = ActiveSheet</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN"><span style="color:blue;">If</span> oWS.PivotTables.Count &lt;&gt;<span lang="EN-IN"><span style="color:blue;">Then</span> <span style="color:blue;">Exit</span> <span style="color:blue;">Sub</span></span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN">oPC = oWS.PivotTables(1).PivotCache</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN">oPT = oPC.CreatePivotTable(oWS.[J1], <span style="color:#a31515;">&#8220;Pivot From Existing Cache&#8221;</span>, <span style="color:blue;">True</span>)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN">oPT.AddFields(oPT.PivotFields(<span style="color:#a31515;">&#8220;Item&#8221;</span>).Name)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN">oPT.AddDataField(oPT.PivotFields(<span style="color:#a31515;">&#8220;Customer&#8221;</span>), <span style="color:#a31515;">&#8220;Quantity&#8221;</span>, xlCount)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN">End</span><span lang="EN-IN"> <span style="color:blue;">Sub</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:100%;"><a href="http://bp3.blogger.com/_s2jU7girbyM/SCAkWqef-8I/AAAAAAAAAec/Fk7XVPgNGlY/s1600-h/dnd_Pivot_Table_Using_Existing_Cache.JPG"><img style="float:left;cursor:pointer;margin:0 10px 10px 0;" src="http://bp3.blogger.com/_s2jU7girbyM/SCAkWqef-8I/AAAAAAAAAec/Fk7XVPgNGlY/s400/dnd_Pivot_Table_Using_Existing_Cache.JPG" border="0" alt="" /></a></span><span lang="EN-IN">Here we are checking if any Pivot Table exist in that particular sheet; if it exists we are using the same cache of the pivot table to create another pivot table</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN"></span></p>
<p><span style="font-size:100%;"></p>
<p></span><span style="font-size:100%;" lang="EN-IN"><br />
</span></div>
<div class="post-footer">
<div class="post-footer-line post-footer-line-1"><span class="post-author vcard">Posted by <span class="fn">Shasur</span> </span><span class="post-timestamp">at <a class="timestamp-link" title="permanent link" rel="bookmark" href="http://vbadud.blogspot.com/2008/05/create-additional-pivot-table-using.html"><abbr class="published" title="00"><span style="color:#225588;">2:26 AM</span></abbr></a> </span><span class="post-icons"><span class="item-control blog-admin pid-58049851"><a title="Edit Post" href="http://www.blogger.com/post-edit.g?blogID=28492262&amp;postID=1283303684811496941"><img class="icon-action" src="http://www.blogger.com/img/icon18_edit_allbkg.gif" alt="" width="18" height="18" /><span style="color:#225588;"> </span></a></span></span></div>
<div class="post-footer-line post-footer-line-2"><span class="post-labels">Labels: <a rel="tag" href="http://vbadud.blogspot.com/search/label/Create%20a%20Pivot%20Table%20from%20Existing%20Pivot%20Cache"><span style="color:#225588;">Create a Pivot Table from Existing Pivot Cache</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Excel%20VBA%20Pivot%20Tables"><span style="color:#225588;">Excel VBA Pivot Tables</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Excel%20VBA%20PivotCache"><span style="color:#225588;">Excel VBA PivotCache</span></a> </span></div>
</div>
</div>
<div class="post hentry uncustomized-post-template"><a name="2789288724238670938"></a></p>
<h3 class="post-title entry-title"><a href="http://vbadud.blogspot.com/2008/05/create-pivot-table-using-excel-vba.html">Create Pivot Table using Excel VBA</a></h3>
<div class="post-body entry-content"><a href="http://bp3.blogger.com/_s2jU7girbyM/SCAhXqef-5I/AAAAAAAAAeE/EPvPFZS4jg0/s1600-h/DND_PivotExample_SourceData.JPG"><img style="float:right;cursor:pointer;margin:0 0 10px 10px;" src="http://bp3.blogger.com/_s2jU7girbyM/SCAhXqef-5I/AAAAAAAAAeE/EPvPFZS4jg0/s400/DND_PivotExample_SourceData.JPG" border="0" alt="" /></a><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<h1><span lang="EN-IN"><span style="font-size:xx-large;"><span style="font-size:130%;"><span style="color:#ff6600;">Macro to Create a Pivot Table from New Pivot Cache</span></span></span></span></h1>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><br />
</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:blue;font-family:'Courier New';" lang="EN-IN">Sub</span><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"> Create_Pivot_Table_From_Cache()</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Dim</span> oPC <span style="color:blue;">As</span> PivotCache</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Dim</span> oPT <span style="color:blue;">As</span> PivotTable</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Dim</span> oWS <span style="color:blue;">As</span> Worksheet</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oWS = ActiveSheet</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oPC = ActiveWorkbook.PivotCaches.Create(xlDatabase, oWS.UsedRange)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oPT = oPC.CreatePivotTable(oWS.[D20], <span style="color:#a31515;">&#8220;Pivot From Cache&#8221;</span>, <span style="color:blue;">True</span>)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oPT.AddFields(oPT.PivotFields(<span style="color:#a31515;">&#8220;Item&#8221;</span>).Name, oPT.PivotFields(<span style="color:#a31515;">&#8220;Customer&#8221;</span>).Name)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">oPT.AddDataField(oPT.PivotFields(<span style="color:#a31515;">&#8220;Qty&#8221;</span>), <span style="color:#a31515;">&#8220;Quantity&#8221;</span>, xlSum)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span><a href="http://bp0.blogger.com/_s2jU7girbyM/SCAhX6ef-6I/AAAAAAAAAeM/WD3AJLYLST0/s1600-h/dnd_Pivot_Table_Using_Cache.JPG"><img style="float:right;cursor:pointer;margin:0 0 10px 10px;" src="http://bp0.blogger.com/_s2jU7girbyM/SCAhX6ef-6I/AAAAAAAAAeM/WD3AJLYLST0/s400/dnd_Pivot_Table_Using_Cache.JPG" border="0" alt="" /></a></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:blue;font-family:'Courier New';" lang="EN-IN">End</span><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"> <span style="color:blue;">Sub</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:blue;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><strong><span style="font-size:8.5pt;font-family:Tahoma;" lang="EN-IN"><a href="//MS.EXCEL.DEV.12.1033/EXCEL.DEV/content/HV10036177.htm"><span style="color:#0560a6;text-decoration:none;">PivotCache</span></a> </span></strong><span style="font-size:8.5pt;font-family:Tahoma;" lang="EN-IN">represents the collection of memory caches from the PivotTable reports in a workbook. Each memory cache is represented by a <strong><a href="//MS.EXCEL.DEV.12.1033/EXCEL.DEV/content/HV10036177.htm"><span style="color:#0560a6;text-decoration:none;">PivotCache</span></a></strong> object.<span> </span>The above example creates a pivotcache from existing data and then using the cache a pivot table is created</span></p>
<p><span style="font-size:10pt;line-height:115%;font-family:'Courier New';" lang="EN-IN"><br />
</span></div>
<div class="post-footer">
<div class="post-footer-line post-footer-line-1"><span class="post-author vcard">Posted by <span class="fn">Shasur</span> </span><span class="post-timestamp">at <a class="timestamp-link" title="permanent link" rel="bookmark" href="http://vbadud.blogspot.com/2008/05/create-pivot-table-using-excel-vba.html"><abbr class="published" title="00"><span style="color:#225588;">2:13 AM</span></abbr></a> </span><span class="post-icons"><span class="item-control blog-admin pid-58049851"><a title="Edit Post" href="http://www.blogger.com/post-edit.g?blogID=28492262&amp;postID=2789288724238670938"><img class="icon-action" src="http://www.blogger.com/img/icon18_edit_allbkg.gif" alt="" width="18" height="18" /><span style="color:#225588;"> </span></a></span></span></div>
<div class="post-footer-line post-footer-line-2"><span class="post-labels">Labels: <a rel="tag" href="http://vbadud.blogspot.com/search/label/Create%20Pivot%20Table%20using%20Excel%20VBA"><span style="color:#225588;">Create Pivot Table using Excel VBA</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Excel%20VBA%20%20PivotTable"><span style="color:#225588;">Excel VBA PivotTable</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Excel%20VBA%20PivotCache"><span style="color:#225588;">Excel VBA PivotCache</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Pivot%20Table%20from%20New%20Pivot%20Cache%20using%20Excel%20VBA"><span style="color:#225588;">Pivot Table from New Pivot Cache using Excel VBA</span></a> </span></div>
</div>
</div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vba2008.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vba2008.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vba2008.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vba2008.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vba2008.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vba2008.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vba2008.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vba2008.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vba2008.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vba2008.wordpress.com/56/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=56&subd=vba2008&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vba2008.wordpress.com/2008/10/17/macro-to-create-a-pivot-table-from-existing-pivot-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de5fc3c7f573ab459e043ea3fc8e407a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vbadud</media:title>
		</media:content>

		<media:content url="http://bp3.blogger.com/_s2jU7girbyM/SCAkWqef-8I/AAAAAAAAAec/Fk7XVPgNGlY/s400/dnd_Pivot_Table_Using_Existing_Cache.JPG" medium="image" />

		<media:content url="http://www.blogger.com/img/icon18_edit_allbkg.gif" medium="image" />

		<media:content url="http://bp3.blogger.com/_s2jU7girbyM/SCAhXqef-5I/AAAAAAAAAeE/EPvPFZS4jg0/s400/DND_PivotExample_SourceData.JPG" medium="image" />

		<media:content url="http://bp0.blogger.com/_s2jU7girbyM/SCAhX6ef-6I/AAAAAAAAAeM/WD3AJLYLST0/s400/dnd_Pivot_Table_Using_Cache.JPG" medium="image" />

		<media:content url="http://www.blogger.com/img/icon18_edit_allbkg.gif" medium="image" />
	</item>
		<item>
		<title>VBA ADO Code for using Excel as Database</title>
		<link>http://vba2008.wordpress.com/2008/10/17/vba-ado-code-for-using-excel-as-database/</link>
		<comments>http://vba2008.wordpress.com/2008/10/17/vba-ado-code-for-using-excel-as-database/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 05:58:57 +0000</pubDate>
		<dc:creator>vbadud</dc:creator>
				<category><![CDATA[Excel VBA]]></category>
		<category><![CDATA[Excel ADO]]></category>
		<category><![CDATA[Excel ADODB]]></category>
		<category><![CDATA[Excel Database]]></category>

		<guid isPermaLink="false">http://vba2008.wordpress.com/?p=54</guid>
		<description><![CDATA[
Using Excel as Database


Though many database systems have come , still there is a need to use Excel as Backend database. The reasons might be many &#8212; you get Excel sheets as a Report and do not want to import that into Access or SQL Server
Here is a simple code that will allow you to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=54&subd=vba2008&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="post hentry uncustomized-post-template"><a name="1843866385269226107"></a></p>
<h3 class="post-title entry-title"><a href="http://vbadud.blogspot.com/2008/05/using-excel-as-database.html">Using Excel as Database</a></h3>
<div class="post-body entry-content">
<p><a href="http://bp0.blogger.com/_s2jU7girbyM/SCWWCOWl4pI/AAAAAAAAAes/Nz6LUjKofAI/s1600-h/ExcelADO.jpg"><img style="float:left;cursor:pointer;margin:0 10px 10px 0;" src="http://bp0.blogger.com/_s2jU7girbyM/SCWWCOWl4pI/AAAAAAAAAes/Nz6LUjKofAI/s400/ExcelADO.jpg" border="0" alt="" /></a><br />
Though many database systems have come , still there is a need to use Excel as Backend database. The reasons might be many &#8212; you get Excel sheets as a Report and do not want to import that into Access or SQL Server</p>
<p>Here is a simple code that will allow you to do exactly that</p>
<p><span style="color:#3333ff;">Sub Excel_ADO()</p>
<p>Dim cN As ADODB.Connection &#8216;* Connection String<br />
Dim RS As ADODB.Recordset &#8216;* Record Set<br />
Dim sQuery As String &#8216;* Query String<br />
Dim i1 As Long<br />
Dim lMaxRow As Long &#8216;* Last Row in the Sheet<br />
Dim iRevCol As Integer &#8216;*<br />
Dim i3 As Integer</p>
<p>On Error GoTo ADO_ERROR</p>
<p>Set cN = New ADODB.Connection<br />
cN.ConnectionString = &#8220;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Orginal.xls;Extended Properties=Excel 8.0;Persist Security Info=False&#8221;<br />
cN.ConnectionTimeout = 40<br />
cN.Open</p>
<p>Set RS = New ADODB.Recordset</p>
<p>lMaxRow = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row<br />
iRevCol = 2</p>
<p>For i1 = 2 To lMaxRow</p>
<p>Application.StatusBar = i1<br />
sQuery = &#8220;Select * From [Sheet1$]&#8220;</p>
<p>RS.ActiveConnection = cN<br />
RS.Source = sQuery<br />
RS.Open</p>
<p>If RS.EOF = True And RS.BOF = True Then<br />
GoTo TakeNextRecord<br />
End If</p>
<p>RS.MoveFirst<br />
Do Until RS.EOF = True<br />
sName = Trim$(RS(&#8220;Name&#8221;).Value)<br />
sAge = Trim$(RS(&#8220;Age&#8221;).Value)<br />
&#8216; Do some operations<br />
RS.MoveNext<br />
Loop</p>
<p>TakeNextRecord:<br />
If RS.State &lt;&gt; adStateClosed Then<br />
RS.Close<br />
End If<br />
Next i1</p>
<p>If Not RS Is Nothing Then Set RS = Nothing<br />
If Not cN Is Nothing Then Set cN = Nothing</p>
<p>ADO_ERROR:<br />
If Err &lt;&gt; 0 Then<br />
Debug.Assert Err = 0<br />
MsgBox Err.Description<br />
Resume Next<br />
End If</p>
<p>End Sub</p>
<p><span style="color:#333333;">All the code remains the same as Access ADO code except the change in connection string. </span></span><span style="color:#3333ff;">cN.ConnectionString = &#8220;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Orginal.xls;Extended Properties=Excel 8.0;Persist Security Info=False&#8221;<br />
</span><span style="color:#3333ff;"></span></div>
<div class="post-footer">
<div class="post-footer-line post-footer-line-1"><span class="post-author vcard">Posted by <span class="fn">Shasur</span> </span><span class="post-timestamp">at <a class="timestamp-link" title="permanent link" rel="bookmark" href="http://vbadud.blogspot.com/2008/05/using-excel-as-database.html"><abbr class="published" title="00"><span style="color:#225588;">5:22 AM</span></abbr></a> </span><span class="post-icons"><span class="item-control blog-admin pid-58049851"><a title="Edit Post" href="http://www.blogger.com/post-edit.g?blogID=28492262&amp;postID=1843866385269226107"><img class="icon-action" src="http://www.blogger.com/img/icon18_edit_allbkg.gif" alt="" width="18" height="18" /><span style="color:#225588;"> </span></a></span></span></div>
<div class="post-footer-line post-footer-line-2"><span class="post-labels">Labels: <a rel="tag" href="http://vbadud.blogspot.com/search/label/Excel%20as%20Database"><span style="color:#225588;">Excel as Database</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/VBA%20use%20Excel%20As%20Database"><span style="color:#225588;">VBA use Excel As Database</span></a> </span></div>
</div>
</div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vba2008.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vba2008.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vba2008.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vba2008.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vba2008.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vba2008.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vba2008.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vba2008.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vba2008.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vba2008.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=54&subd=vba2008&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vba2008.wordpress.com/2008/10/17/vba-ado-code-for-using-excel-as-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de5fc3c7f573ab459e043ea3fc8e407a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vbadud</media:title>
		</media:content>

		<media:content url="http://bp0.blogger.com/_s2jU7girbyM/SCWWCOWl4pI/AAAAAAAAAes/Nz6LUjKofAI/s400/ExcelADO.jpg" medium="image" />

		<media:content url="http://www.blogger.com/img/icon18_edit_allbkg.gif" medium="image" />
	</item>
		<item>
		<title>Solution for 1004 &#8212; The file could not be accessed while saving the File</title>
		<link>http://vba2008.wordpress.com/2008/10/17/solution-for-1004-the-file-could-not-be-accessed-while-saving-the-file/</link>
		<comments>http://vba2008.wordpress.com/2008/10/17/solution-for-1004-the-file-could-not-be-accessed-while-saving-the-file/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 05:58:16 +0000</pubDate>
		<dc:creator>vbadud</dc:creator>
				<category><![CDATA[Excel VBA]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://vba2008.wordpress.com/?p=52</guid>
		<description><![CDATA[
Excel VBA &#8211; 1004 &#8212; The file could not be accessed

1004 Microsoft Office Excel cannot access the file &#8216;C:\temp&#8217;. There are several possible reasons:
• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=52&subd=vba2008&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="post hentry uncustomized-post-template"><a name="6261145309603498118"></a></p>
<h3 class="post-title entry-title"><a href="http://vbadud.blogspot.com/2008/05/excel-vba-1004-file-could-not-be.html">Excel VBA &#8211; 1004 &#8212; The file could not be accessed</a></h3>
<div class="post-body entry-content">
<p>1004 Microsoft Office Excel cannot access the file &#8216;C:\temp&#8217;. There are several possible reasons:</p>
<p>• The file name or path does not exist.<br />
• The file is being used by another program.<br />
• The workbook you are trying to save has the same name as a currently open workbook.</p>
<p>1004 &#8212; The file could not be accessed. Try one of the following:</p>
<p>• Make sure the specified folder exists.<br />
• Make sure the folder that contains the file is not read-only.<br />
• Make sure the file name does not contain any of the following characters: &lt; &gt; ? [ ] : | or *<br />
• Make sure the file/path name doesn&#8217;t contain more than 218 characters.</p>
<p>This error occurs because of unwanted characters in the File. The following function would help in removing those characters:</p>
<p><a href="http://bp2.blogger.com/_s2jU7girbyM/SDoFLUjBIhI/AAAAAAAAAfE/cWWVE3_oiBo/s1600-h/Excel+Save+Error.jpg"><img style="cursor:pointer;" src="http://bp2.blogger.com/_s2jU7girbyM/SDoFLUjBIhI/AAAAAAAAAfE/cWWVE3_oiBo/s400/Excel+Save+Error.jpg" border="0" alt="" /></a></p>
<p><a href="http://bp2.blogger.com/_s2jU7girbyM/SDoFLUjBIhI/AAAAAAAAAfE/cWWVE3_oiBo/s1600-h/Excel+Save+Error.jpg"><span style="color:#225588;">Function ClearCharacters(ByVal sDirtyString As String) As String</p>
<p>Dim arUnWantedCharacter(1 To 6) As String<br />
Dim IsClear As Boolean<br />
Dim i As Integer<br />
Dim strCleanString As String<br />
Dim j As Integer</p>
<p>arUnWantedCharacter(1) = &#8220;\&#8221;<br />
arUnWantedCharacter(2) = &#8220;/&#8221;<br />
arUnWantedCharacter(3) = &#8220;?&#8221;<br />
arUnWantedCharacter(4) = &#8220;*&#8221;<br />
arUnWantedCharacter(5) = &#8220;["<br />
arUnWantedCharacter(6) = "]&#8220;</p>
<p>IsClear = True</p>
<p>strCleanString = vbNullString<br />
For i = 1 To UBound(arUnWantedCharacter)<br />
If InStr(1, sDirtyString, arUnWantedCharacter(i)) Then<br />
IsClear = False<br />
For j = 1 To Len(sDirtyString)<br />
If Mid$(sDirtyString, j, 1) &lt;&gt; arUnWantedCharacter(i) Then<br />
strCleanString = strCleanString &amp; Mid$(sDirtyString, j, 1)<br />
End If<br />
Next j<br />
sDirtyString = strCleanString<br />
End If<br />
Next i</p>
<p>If IsClear = True Then strCleanString = sDirtyString</p>
<p>Finally:</p>
<p>ClearCharacters = strCleanString</p>
<p>End Function</p>
<p></span></a><br />
<a href="http://bp0.blogger.com/_s2jU7girbyM/SDoFL0jBIiI/AAAAAAAAAfM/FMydiwTOJsM/s1600-h/Excel+Save+Error+2.jpg"><span style="color:#225588;"><img style="cursor:pointer;" src="http://bp0.blogger.com/_s2jU7girbyM/SDoFL0jBIiI/AAAAAAAAAfM/FMydiwTOJsM/s400/Excel+Save+Error+2.jpg" border="0" alt="" /></span></a></div>
<div class="post-footer">
<div class="post-footer-line post-footer-line-1"><span class="post-author vcard">Posted by <span class="fn">Shasur</span> </span><span class="post-timestamp">at <a class="timestamp-link" title="permanent link" rel="bookmark" href="http://vbadud.blogspot.com/2008/05/excel-vba-1004-file-could-not-be.html"><abbr class="published" title="00"><span style="color:#225588;">5:32 PM</span></abbr></a> </span><span class="post-icons"><span class="item-control blog-admin pid-58049851"><a title="Edit Post" href="http://www.blogger.com/post-edit.g?blogID=28492262&amp;postID=6261145309603498118"><img class="icon-action" src="http://www.blogger.com/img/icon18_edit_allbkg.gif" alt="" width="18" height="18" /><span style="color:#225588;"> </span></a></span></span></div>
<div class="post-footer-line post-footer-line-2"><span class="post-labels">Labels: <a rel="tag" href="http://vbadud.blogspot.com/search/label/1004%20--%20The%20file%20could%20not%20be%20accessed"><span style="color:#225588;">1004 &#8212; The file could not be accessed</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/1004%20Microsoft%20Office%20Excel%20cannot%20access%20the%20file"><span style="color:#225588;">1004 Microsoft Office Excel cannot access the file</span></a>, <a rel="tag" href="http://vbadud.blogspot.com/search/label/Excel%20VBA%201004%20--%20The%20file%20could%20not%20be%20accessed"><span style="color:#225588;">Excel VBA 1004 &#8212; The file could not be accessed</span></a> </span></div>
</div>
</div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vba2008.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vba2008.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vba2008.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vba2008.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vba2008.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vba2008.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vba2008.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vba2008.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vba2008.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vba2008.wordpress.com/52/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=52&subd=vba2008&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vba2008.wordpress.com/2008/10/17/solution-for-1004-the-file-could-not-be-accessed-while-saving-the-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de5fc3c7f573ab459e043ea3fc8e407a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vbadud</media:title>
		</media:content>

		<media:content url="http://bp2.blogger.com/_s2jU7girbyM/SDoFLUjBIhI/AAAAAAAAAfE/cWWVE3_oiBo/s400/Excel+Save+Error.jpg" medium="image" />

		<media:content url="http://bp0.blogger.com/_s2jU7girbyM/SDoFL0jBIiI/AAAAAAAAAfM/FMydiwTOJsM/s400/Excel+Save+Error+2.jpg" medium="image" />

		<media:content url="http://www.blogger.com/img/icon18_edit_allbkg.gif" medium="image" />
	</item>
		<item>
		<title>The Explorers collection contains views of all open folders.</title>
		<link>http://vba2008.wordpress.com/2008/10/17/the-explorers-collection-contains-views-of-all-open-folders/</link>
		<comments>http://vba2008.wordpress.com/2008/10/17/the-explorers-collection-contains-views-of-all-open-folders/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 05:57:56 +0000</pubDate>
		<dc:creator>vbadud</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://vba2008.wordpress.com/?p=50</guid>
		<description><![CDATA[
Explorers Collection in Outlook

 

Each open folder view is an Explorer object and has a CurrentFolder object, which is the folder
whose data is currently being displayed in the Explorer. The currently active Explorer object
is also available as the ActiveExplorer object. 

Sub OL_Explorer_Collection()

Dim oExpo As Explorer

For Each oExpo In Explorers
MsgBox(oExpo.Caption)
Next

End Sub

When you open Outlook using code Explorers [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=50&subd=vba2008&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><div class="post hentry uncustomized-post-template"><a name="4724892273666270850"></a></p>
<h3 class="post-title entry-title"><a href="http://vbadud.blogspot.com/2008/06/explorers-collection-in-outlook.html">Explorers Collection in Outlook</a></h3>
<div class="post-body entry-content">
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span lang="EN-IN"></span></p>
<p class="MsoNormal"><span lang="EN-IN">Each open folder view is an Explorer object and has a CurrentFolder object, which is the folder</span></p>
<p class="MsoNormal"><span lang="EN-IN">whose data is currently being displayed in the Explorer. The currently active Explorer object</span></p>
<p class="MsoNormal"><span lang="EN-IN">is also available as the ActiveExplorer object. </span></p>
<p class="MsoNormal"><span lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:blue;font-family:'Courier New';" lang="EN-IN">Sub</span><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"> OL_Explorer_Collection()</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Dim</span> oExpo <span style="color:blue;">As</span> Explorer</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">For</span> <span style="color:blue;">Each</span> oExpo <span style="color:blue;">In</span> Explorers</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN">MsgBox(oExpo.Caption)</span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"><span style="color:blue;">Next</span></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:blue;font-family:'Courier New';" lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span style="font-size:10pt;color:blue;font-family:'Courier New';" lang="EN-IN">End</span><span style="font-size:10pt;font-family:'Courier New';" lang="EN-IN"> <span style="color:blue;">Sub</span></span></p>
<p class="MsoNormal"><span lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin-bottom:0;line-height:normal;"><span lang="EN-IN">When you open Outlook using code Explorers will be not be there and the count will be zero. Normally opening outlook will have one Explorer, which is the active explorer</span></p>
<p class="MsoNormal"><span lang="EN-IN"></span></p>
<p class="MsoNormal" style="margin:.1in 0;"><span lang="EN-IN">An explorer need not be visible to be included in the Explorers collection.</span></p>
<p><span style="font-size:11pt;line-height:115%;font-family:Calibri;" lang="EN-IN">Use the <a href="//MS.OUTLOOK.DEV.12.1033/OUTLOOK.DEV/content/HV10036835.htm"><span style="color:windowtext;text-decoration:none;">Explorers</span></a> property to return the Explorers object from the <a href="//MS.OUTLOOK.DEV.12.1033/OUTLOOK.DEV/content/HV10036695.htm"><span style="color:windowtext;text-decoration:none;">Application</span></a> object. </span></div>
<div class="post-footer">
<div class="post-footer-line post-footer-line-1"><span class="post-author vcard">Posted by <span class="fn">Shasur</span> </span><span class="post-timestamp">at <a class="timestamp-link" title="permanent link" rel="bookmark" href="http://vbadud.blogspot.com/2008/06/explorers-collection-in-outlook.html"><abbr class="published" title="00"><span style="color:#225588;">12:53 AM</span></abbr></a> </span><span class="post-icons"><span class="item-control blog-admin pid-58049851"><a title="Edit Post" href="http://www.blogger.com/post-edit.g?blogID=28492262&amp;postID=4724892273666270850"><img class="icon-action" src="http://www.blogger.com/img/icon18_edit_allbkg.gif" alt="" width="18" height="18" /><span style="color:#225588;"> </span></a></span></span></div>
<div class="post-footer-line post-footer-line-2"><span class="post-labels">Labels: <a rel="tag" href="http://vbadud.blogspot.com/search/label/Outlook%20VBA%20Explorers%20collection"><span style="color:#225588;">Outlook VBA Explorers collection</span></a> </span></div>
</div>
</div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vba2008.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vba2008.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vba2008.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vba2008.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vba2008.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vba2008.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vba2008.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vba2008.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vba2008.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vba2008.wordpress.com/50/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vba2008.wordpress.com&blog=5204430&post=50&subd=vba2008&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://vba2008.wordpress.com/2008/10/17/the-explorers-collection-contains-views-of-all-open-folders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/de5fc3c7f573ab459e043ea3fc8e407a?s=96&#38;d=identicon" medium="image">
			<media:title type="html">vbadud</media:title>
		</media:content>

		<media:content url="http://www.blogger.com/img/icon18_edit_allbkg.gif" medium="image" />
	</item>
	</channel>
</rss>