Monday, November 30, 2009

Export to Excel in VB6

Dim strAppDetails As String 'Used as part of the Report page footer...
Dim adoCon As ADODB.Connection 'DB Connection...
Dim adoRs As ADODB.Recordset 'Recordset upon which the report will be based...
Dim excapp As Excel.Application
Dim excwb As Excel.Workbook
Dim excss As Excel.Worksheet
Dim excs As Excel.Worksheet

'Switch on error handler...
On Error GoTo Errhandler

Set excapp = New Excel.Application 'Create a new instance of Excel
Set excwb = excapp.Workbooks.Add 'Add a new workbook
'excwb.Worksheets(0).Delete 'Delete worksheets
Set excss = excwb.ActiveSheet 'Active current worksheet
'Set excss = excwb.Worksheets.Add 'Add a new worksheet

excss.Name = "FileTracker Report" 'Name the Excel Report
excapp.Visible = True 'Show it to the user

'Set Mouse pointer (Reset in the form's "Activate" sub)...
Screen.MousePointer = vbHourglass

'Create DB objects...
Set adoCon = New ADODB.Connection
Set adoRs = New ADODB.Recordset

'Login to database
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Password=" & Chr$(89) & Chr$(101) & Chr$(108) & Chr$(111) & Chr$(119) & Chr$(75) & Chr$(97) & Chr$(110) & Chr$(97) & Chr$(114) & Chr$(121) & ";" & _
"User ID=" & frmMDI.staMain.Panels("UserName").Text & ";" & _
"Data Source=" & gdbFTrak.Name & ";" & _
"Jet OLEDB:System database=" & DBEngine.SystemDB

'Build Recordset...
With adoRs
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.ActiveConnection = adoCon
.Open mstrSql
If .RecordCount > 0 Then
End If
End With

' Fill the Excel with the recordset data
Dim iCount As Integer

With excss
For iCount = 0 To (adoRs.Fields.Count - 1)
.Cells(1, iCount + 1) = adoRs.Fields(iCount).Name 'Assigning the column names
Next iCount
.Range("A2").CopyFromRecordset adoRs 'Binding the recordset to Excel
End With

'Formating the Date field to dd-mmm-yyyy format
Dim iCount1 As Integer
Dim iCountRec As Integer
Dim excelDate As Date
With excss
For iCount1 = 0 To (adoRs.Fields.Count - 1)
If adoRs.Fields(iCount1).Name = "DateOfLoss" Or adoRs.Fields(iCount1).Name = "DateToLoc" Then
For iCountRec = 0 To (adoRs.RecordCount - 1)
excss.Application.ActiveCell(iCountRec + 2, iCount1 + 1).NumberFormat = "dd-mmm-yyyy"
Next iCountRec
End If
Next iCount1
End With

'Housekeeping - destroy the recordset and reclaim memory...
Set excwb = Nothing 'Disconnect from Excel (let the user take over)
Set excapp = Nothing
Set adoRs = Nothing

'Set Mouse pointer (Reset in the form's "Activate" sub)...
Screen.MousePointer = vbDefault

'Don't fall into the error handler...
Exit Sub

Errhandler: '---------------------------------------------
'Reset Mouse pointer...
Screen.MousePointer = vbDefault

Select Case Err.Number
Case Else
'Call the unanticipated error handler...
Call Errhandler(Err, "cmdExportToExcel_Click")
End Select

'Exit gracefully...
Resume Clearup

Tuesday, May 26, 2009

SharePoint Ghosted and Unghosted Pages

Each .aspx page is rendered by one of two possible parsers. When a request is received for an .aspx page, the SharePoint isapi filter determines who will handle the rendering of the page— orthe SharePoint SafeMode parser. The first parser,, requires the least amount of introduction. The second parser is unique to Windows SharePoint Services.

The intent of this discussion is to cover the differences between the two parsers. To be very clear, this discussion applies to pages which come from the main application root of a SharePoint virtual server. Pages which originate from either the "_layouts" or "_vti_bin" virtual directories can be excluded from the discussion.
As everyone knows, all pages within SharePoint are stored in the database. This effectively means that for each document, you will find a row in the docs table for that document. The actual file is stored in the Content column. This is true for all files. However, there is one exception - some .aspx pages don't actually have their content stored in the database. Instead, these pages reference files which exist on the server's file system. These pages are considered ghosted pages.
From a technical standpoint, ghosted pages are those rows in the docs table which have null values for the Content column and a non-null value for the SetupPath column which points to a file on the file system itself. The referenced file essentially serves as a template and content source.
What pages are ghosted? For example, the default home page is a ghosted page. Any web part pages created the via New Web Part Page user interface also ghosted.
As you can see, I've described ghosted pages as the exception to the rule. What does it mean if a document doesn't reference a template on the file system? Or, more to the point, the Content column actually contains data? These pages are known as unghosted .aspx pages and they are routed through the SafeMode parser.

Monday, February 16, 2009

Text of Budget speech of acting finance minister Pranab Mukherjee

Following is the text of Budget speech of acting finance minister Pranab Mukherjee.

Mr. Speaker, Sir,

I rise to present the Interim Budget for 2009-10.

2. Five years ago the people of India had voted for change. In the words of our Prime Minister, Dr. Manmohan Singh, people had sought "a change in the manner in which this country is run, a change in the national priorities and a change in the processes and focus of the Government". The Common Minimum Programme of the United Progressive Alliance, built around ‘Aam Aadmi’, was a response to this call for change. As indicated by Shri P. Chidambaram in July 2004, this programme spelt out seven clear economic objectives:

(i) maintaining a growth rate of 7-8 per cent per year for a sustained period;

(ii) providing universal access to quality basic education and health;

(iii) generating gainful employment and promoting investment;

(iv) assuring hundred days of employment to the breadwinner in each family at the minimum wage;

(v) focusing on agriculture, rural development and infrastructure;

(vi) accelerating fiscal consolidation and reform; and

(vii) ensuring higher and more efficient fiscal devolution.

3. As I present the sixth budget of the Government of the United Progressive Alliance which completes its tenure in a couple of months, I can say with confidence that every effort has been made by the government to deliver on the commitments made.

4. For the first four years of the UPA government, our policies ensured a dream run for the economy with Gross Domestic Product (GDP) recording increase of 7.5 per cent, 9.5 per cent, 9.7 per cent and 9 per cent from fiscal year 2004-05 to 2007-08. For the first time, the Indian economy showed sustained growth of over 9 per cent for three consecutive years. With per capita income growing at 7.4 per cent per annum, this represented the fastest ever improvement in living standards over a four year period.

5. During this period, the fiscal deficit came down from 4.5 per cent in 2003-04 to 2.7 per cent in 2007-08 and the revenue deficit declined from 3.6 per cent to 1.1 per cent.

6. Investment and savings showed significant improvement. The domestic investment rate as a proportion of GDP increased from 27.6 per cent in 2003-04 to over 39 per cent in 2007-08. The gross domestic savings rate shot up from 29.8 per cent to 37.7 per cent during this period. The gross capital formation in agriculture as a proportion of agriculture GDP improved from 11.1 per cent in 2003-04 to 14.2 per cent in 2007-08.

7. The buoyant growth of Government revenues facilitated fiscal consolidation as mandated in the FRBM Act. The tax to GDP ratio increased from 9.2 per cent in 2003-04 to 12.5 per cent in 2007-08 bringing us within striking distance of the target for fiscal correction. This also enhanced our capacity to raise resources internally to finance our growth at the rate of 9 per cent per annum during the Eleventh Five Year Plan.

8. All this would not have been possible without the guidance
of UPA Chairperson, Smt. Sonia Gandhi, the inspiring leadership of Prime Minister, Dr. Manmohan Singh and the hard work put in by my predecessor, Shri P. Chidambaram.

Friday, February 6, 2009

word power made easy

Ø Repercussions—effects,impact,outcome,influence
Ø Harbinger—indication
Ø Tantamount—equal,as good as
Ø Instigate—intiate,activate
Ø Ambivalence---the presence of two opposing ideas, attitudes, or emotions at the same time,conflict of ideas or attitudes
Ø Dossier---record,folder,profile
Ø Carnage—bloodnbath,killing,
Ø Massacre—mass murder,carnage
Ø Emulate—imitate,follow
Ø Retaliate—hit back,react
Ø Complicity—responsibility,involvement,participation
Ø Horde—mass,gang,group
Ø Nurse—care for,look after
Ø Indulge—treat,spoil
Ø Covert Action-- An operation designed to influence governments, events, organizations, or persons in support of foreign policy in a manner that is not necessarily, Military maneuvers behind enemy lines are often covert actions, so that the enemy will not detect any forces in the area.
Ø Bait—temptation,attraction
Ø Intact—unbroken
Ø Hamper—slow down,obstruct
Ø Catastrophic—terrible,tragic,disastrous
Ø Conciliatory—peace making,appeasing
Ø Restraint—control,command
Ø Grave—serious
Ø Provocation—frustation,irritation
Ø Timid—shy
Ø Devoid—lacking-------completely lacking on somethong
Ø Assert—declare,emphasize
Ø Deter—prevent,frighten,put off
Ø Pursuit—hunt,chase,search
Ø Accrue—grow,increase,mount up,accumulate,add
Ø Audacious—risky,brave,impudent
Ø radicalization -- to undergo fundamental change, or introduce sweeping change in something
Ø propensity—tendency,partiality
Ø abdicate—rive up,relinquish
Ø fizzle—hiss,bubble
Ø sublime—inspiring,moving,magnificiant
Ø balsam—ointment
Ø righteousness—morality,justice
Ø virile--- relating to or having the characteristics of an adult male, howing energy, power, and forcefulness,
Ø righteous—blameless,good
Ø benevolence—kindness,compassion,generosity,goodwill
Ø paralytic—immobile
Ø alm-house
Ø thrive—succeed,florish,increase
Ø wherewithal—funds,money
Ø rhetoric—language,public speaking
Ø collude—join together
Ø clout—influence,power
Ø leverage—influnce, power, control, force
Ø auspices---backing, support, sponsorship
Ø nuke--- to attack somebody or something with nuclear weapons
Ø tartly—sharply, unkindly
Ø assault—attack
Ø Anonymity—secracy, ambiguity
Ø Détente
Ø Glimpses-- a quick or incomplete look or sighting of somebody or something, • I just caught a glimpse of her face in the crowd.
Ø Elicitation-- to cause or produce something as a reaction or response to a stimulus of some kind. Ex: His jokes failed to elicit even the faintest of smiles from her.
Ø Grim—harsh, severe, bleak
Ø Severance—separation, taking apart
Ø Deplete—reduce, diminish
Ø Bankruptcy—ruin, economic failure
Ø Danglers---swing or hang loosely, or cause something to swing or hang loosely.Ex: The children dangled their legs over the side of the swimming pool
Ø Enticement—incentive, invitation
Ø Unifies—make things into one. Ex: to bring people or things together to form a single unit or entity.
Ø Itinerary—route, journey, tour, program
Ø Plunging—dropping, reducing, falling.sinking.
Ø Spiraling—escalation,increase,growth.
Ø Diversified-- to become more varied, or make something more varied, to expand into new areas of business, or expand a commercial organization into new areas.
Ø Interim—short-term,temperory, acting.
Ø Sought—wanted, hunted, required
Ø Devolution—decentralization, deligation,transfer.
Ø Slammed—bang,crash,smash
Ø Prophets—forecasters,psychic, diviner,spiritualist.
Ø Beleaguered—struggling,harrased, stressed,under attack
Ø Perpetrating—commit, pull off,be responsible for.
Ø Severance— separation.
Ø Legitimacy—authenticity, authority
Ø Overlay—cover, place on top, superimpose, spread over the surface
Ø Positing—put something forward. Ex: to put forward for consideration something such as a suggestion, assumption, or fact
Ø Sparingly – carefully, cautiously
Ø Intricate – complicated, difficult, complex, elaborate.
Ø Hitch—drawback, delay, problem.
Ø Agnostic—disbeliever, doubter
Ø Conduits—channel for liquid, protective cover for cable, cobveyor of information (somebody or something that conveys information, especially in secret)
Ø Demarcate—separate, distinguish, isolate, segregate.
Ex: The BizTalk architecture is designed so that the processing responsibilities within the Messaging Engine are clearly demarcated.
Ø Esoteric—obscure, mysterious, impenetrable
Ø Niche—place, position, function, role.
Ø Ubiquitous—ever present, everywhere, omnipresent
Ø Permeate—fill, saturate, filter through, leak into.
Ø Perceived—apparent, supposed, seeming.
Ø Notion—idea, view, concept.
Ø Itinerary—schedule, rote, journey, program
Ø Panacea—cure, solution, answer, universal remedy.
Ø Punk-- an offensive term for a young man regarded as worthless, lazy, or arrogant, body piercing, and unconventional hairstyles, makeup, and clothing
Ø Fleet—navy, task force
Ø Scudding-- to move swiftly and smoothly
Ø Bum-- somebody regarded as irresponsible or worthless, a homeless person living on the street, useless, worthless, or of poor quality.
Ø Batboy-- in baseball, a person employed to look after the team's equipment, especially the bats
Ø Seldom—hardly ever, infrequently, rarely, not often.
Ø Dirt—mud, dust, clay, earth.
Ø Recipe—formula, guidelines, instructions, procedure, way, technique.
Ø Empower—authorize, allow, sanction, give power to.
Ø Skeptical—cynical, doubtful, disbelieving, dubious, unconvinced, incredulous.
Ø Deprecate—criticize, condemn, deplore, denounce, censure, denigrate, disapprove of
Ø Credibility –trustworthiness, reliability, authority, sincerity, standing.
Ø Ancillary—additional, secondary, supplementary
Ø Remittance—payment, allowance, transfer of fund, release, discharge.
Ø Delineate—define, outline, describe, explain
Ø Hallmark—stamp, trademark, characteristic, brand, feature, property

Wednesday, February 4, 2009

Existing page to AJAX enabled page in Sharepoint

Adding Microsoft ASP.NET AJAX Technology to SharePoint Pages
To extend your SharePoint site with Microsoft ASP.NET AJAX 1.0, need to perform a few steps.
• First, need to download and install ASP.NET AJAX on servers
• Second, need to extend web.config with some settings to enable ASP.NET AJAX technology.
• Third, need to add the ASP.NET AJAX Script Manager into master page to enable scenarios such as Extenders or UpdatePanels.

A. Installing Microsoft ASP.NET AJAX 1.0
After installing add Reference ,System.Web.Extensions.
B. Extending SharePoint web.config files with Microsoft ASP.NET AJAX 1.0
Extending SharePoint web.config files with ASP.NET AJAX requires the some Ajax registration entries in-line with WSS registration entries. To do this we need to edit SharePoint web.config file.
1. Add a element to the tag:

2. Add a section as a child of the / tag:

3. Add the following tag to the tag, within :

----This has come by installing AJAX
4. Add some new registrations to the end of the section:

5. Add a new registration to the HttpModules section, beneath any existing registrations:

6. Add a SafeControl entry for the System.Web.UI namespace from Microsoft Ajax Extensions, within the /section:

7. Finally, add the following configuration tags at the bottom of web.config, near the bottom before the end tag:

type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

C. Adding a ScriptManager into a SharePoint MasterPage
To statically embed a script manager into a page, it is recommended that, add the ScriptManager into the master page of a site.
To do this, open up the master page for your site. Typically, this will be located at /_catalogs/masterpage. You can edit this file by opening it in an editor such as Microsoft SharePoint Designer, or directly in Notepad by opening your master page library via DAV (typically \\server\\_catalogs\masterpage.)
Add the following into the markup of your page. A recommended location is right beneath the WebPartManager registration (search for ):

D. Using UpdatePanels within SharePoint
UpdatePanels are a very useful addition to ASP.NET AJAX, and represent the simplest way to convert existing, standard ASP.NET controls and parts to take advantage of Ajax techniques. However, there are some changes within Windows SharePoint Services which may get in the way of working with ASP.NET AJAX.
Windows SharePoint Services JavaScript has onSubmit wrapper which is used to override the default form action. This work is put in place to ensure that certain types of URLs, which may contain double byte characters, will fully work across most postback and asynchronous callback scenarios. However, if your scenarios do not involve double byte character URLs, you may successful disable this workaround and gain the ability to use ASP.NET AJAX UpdatePanels.
To do this, you may need to register a client startup script which disables this workaround, in addition to resetting the default form action:

This script may be directly embedded in the page, or could be emitted by a control that uses the UpdatePanel.
E. Modify Windows SharePoint Services 3.0 scripts to change doPostBack() behavior
To modify scripts to ensure proper doPostBack() behavior
For ASP.NET controls that use the JavaScript _doPostBack() function to commit changes, a regular full-page postback event may occur even when the Web Part is inside an UpdatePanel control. Windows SharePoint Services 3.0 and ASP.NET AJAX cache certain form actions, which can cause a conflict between SharePoint and ASP.NET AJAX. To change this behavior, you must add code to scripts that are running in Windows SharePoint Services 3.0.
private void EnsurePanelFix()
if (this.Page.Form != null)
String fixupScript = @"
function _initFormActionAjax()
if (_spEscapedFormAction == document.forms[0].action)
document.forms[0]._initialAction =
var RestoreToOriginalFormActionCore =
RestoreToOriginalFormAction = function()
if (_spOriginalFormAction != null)
document.forms[0]._initialAction =