If are a diehard ADO user. Here is the connection string for Excel
sXL = "c:\DaniWebExample.xls"
Set Cn = New ADODB.ConnectionCn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sXL & ";Extended Properties=Excel 8.0;Persist Security Info=False"Cn.ConnectionTimeout = 40Cn.Open
The rest is the usual ADO recordset retrieving technique
Tuesday, September 26, 2006
Using MS Excel as Database : ADODB
If are a diehard ADO user. Here is the connection string for Excel
sXL = "c:\DaniWebExample.xls"
Set Cn = New ADODB.ConnectionCn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & sXL & ";Extended Properties=Excel 8.0;Persist Security Info=False"Cn.ConnectionTimeout = 40
Cn.Open
The rest is the usual ADO recordset retrieving technique
sXL = "c:\DaniWebExample.xls"
Set Cn = New ADODB.ConnectionCn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & sXL & ";Extended Properties=Excel 8.0;Persist Security Info=False"Cn.ConnectionTimeout = 40
Cn.Open
The rest is the usual ADO recordset retrieving technique
Saturday, July 08, 2006
VBA - Creating PowerPoint Presentation
Most often we will come across a scenario where powerpoint slides need to be created automatically.
Here is a sample & simple code to do that. This code is created using VBA (Excel 2000)
Sub Create_PowerPoint_Slides()
On Error GoTo Err_PPT
Dim oPA As PowerPoint.Application
Dim oPP As PowerPoint.Presentation
Dim oPS As PowerPoint.Slide
Dim oShape As PowerPoint.Shape
Dim sPath As String
Dim sFile As String
Dim i1 As Integer
sPath = "C:\"
sFile = "MyfileName"
Set oPA = New PowerPoint.Application
oPA.Visible = msoTrue
Set oPP = oPA.Presentations.Add(msoTrue)
For i1 = 1 To 10
oPP.Slides.Add 1, ppLayoutBlank
Next i1
Set oPS = oPP.Slides(1)
Set oShape = oPS.Shapes.AddTextbox(msoTextOrientationHorizontal, 140#, 246#, 400#, 36#)
oShape.TextFrame.WordWrap = msoTrue
oShape.TextFrame.TextRange.Text = "Comments For File : " & sFile
With oShape
.Fill.Visible = msoTrue
.Fill.Solid
.Fill.ForeColor.RGB = RGB(204, 255, 255)
.Line.Weight = 3#
.Line.Visible = msoTrue
.Line.ForeColor.SchemeColor = ppForeground
.Line.BackColor.RGB = RGB(255, 255, 255)
End With
oPP.SaveAs sPath & sFile & ".ppt"
oPP.Close
oPA.Quit
If Not oPS Is Nothing Then Set oPS = Nothing
If Not oPP Is Nothing Then Set oPP = Nothing
If Not oPA Is Nothing Then Set oPA = Nothing
Err_PPT:
If Err <> 0 Then
MsgBox Err.Description
Err.Clear
Resume Next
End If
End Sub
Here is a sample & simple code to do that. This code is created using VBA (Excel 2000)
Sub Create_PowerPoint_Slides()
On Error GoTo Err_PPT
Dim oPA As PowerPoint.Application
Dim oPP As PowerPoint.Presentation
Dim oPS As PowerPoint.Slide
Dim oShape As PowerPoint.Shape
Dim sPath As String
Dim sFile As String
Dim i1 As Integer
sPath = "C:\"
sFile = "MyfileName"
Set oPA = New PowerPoint.Application
oPA.Visible = msoTrue
Set oPP = oPA.Presentations.Add(msoTrue)
For i1 = 1 To 10
oPP.Slides.Add 1, ppLayoutBlank
Next i1
Set oPS = oPP.Slides(1)
Set oShape = oPS.Shapes.AddTextbox(msoTextOrientationHorizontal, 140#, 246#, 400#, 36#)
oShape.TextFrame.WordWrap = msoTrue
oShape.TextFrame.TextRange.Text = "Comments For File : " & sFile
With oShape
.Fill.Visible = msoTrue
.Fill.Solid
.Fill.ForeColor.RGB = RGB(204, 255, 255)
.Line.Weight = 3#
.Line.Visible = msoTrue
.Line.ForeColor.SchemeColor = ppForeground
.Line.BackColor.RGB = RGB(255, 255, 255)
End With
oPP.SaveAs sPath & sFile & ".ppt"
oPP.Close
oPA.Quit
If Not oPS Is Nothing Then Set oPS = Nothing
If Not oPP Is Nothing Then Set oPP = Nothing
If Not oPA Is Nothing Then Set oPA = Nothing
Err_PPT:
If Err <> 0 Then
MsgBox Err.Description
Err.Clear
Resume Next
End If
End Sub
Wednesday, July 05, 2006
Extracting Keywords -- Code
Sub GetKeyWords()
Dim oWA As Word.Application
Dim oWD As Word.Document
Set oWD = Documents("c:\Sample.Doc")
sKeyWords = oWD.BuiltinDocumentProperties("Keywords").Value
If not oWD is nothing then set oWD = nothing
If not oWA is nothing then set oWA = nothing
End Sub
Need Business Long Distance, Voice PRI, and Business VOIP service? Compare free Long Distance Price Quotes from over 30 providers!
Dim oWA As Word.Application
Dim oWD As Word.Document
Set oWD = Documents("c:\Sample.Doc")
sKeyWords = oWD.BuiltinDocumentProperties("Keywords").Value
If not oWD is nothing then set oWD = nothing
If not oWA is nothing then set oWA = nothing
End Sub
Need Business Long Distance, Voice PRI, and Business VOIP service? Compare free Long Distance Price Quotes from over 30 providers!
Saturday, May 27, 2006
SQL Server 2005 - Remote Connection Part I
If you have downloaded the express edition, you may not connect to the server from a remote machine.
In the SQL Server Configuration Manager (SSCM) enable the Remote Connections Option
Under the SQL Native Client Configuration enable TCP/IP protocol (see Figure below)
In the SQL Server Configuration Manager (SSCM) enable the Remote Connections Option
Under the SQL Native Client Configuration enable TCP/IP protocol (see Figure below)

Sunday, May 21, 2006
Welcome to VBA Tips & Tricks
Hi All
Welcome to VBA Tips & Tricks.
All VBA related information will be posted on this blog. Of late, VBA has been disregarded by many software professionals for .Net, c# and other technologies. This blog will also post articles related to them too
Happy reading
Welcome to VBA Tips & Tricks.
All VBA related information will be posted on this blog. Of late, VBA has been disregarded by many software professionals for .Net, c# and other technologies. This blog will also post articles related to them too
Happy reading
Subscribe to:
Posts (Atom)
Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.