Creating excel add ins

Posted on 2006-06-05
Medium Priority
Last Modified: 2012-06-27
Hi experts,

I have created this code which extracts data from sqlserver
and imports it directly my excel spread sheet.
Public Sub DataExtract()
' Create a connection object.
Dim cnPubs As ADODB.Connection
Set cnPubs = New ADODB.Connection

' Provide the connection string.
Dim strConn As String

'Use the SQL Server OLE DB Provider.

'Connect to the Pubs database on the local server.
strConn = strConn & "DATA SOURCE=(local);INITIAL CATALOG=pubs;"

'Use an integrated login.
strConn = strConn & " INTEGRATED SECURITY=sspi;"

'Now open the connection.
cnPubs.Open strConn

' Create a recordset object.
Dim rsPubs As ADODB.Recordset
Set rsPubs = New ADODB.Recordset

With rsPubs
    ' Assign the Connection object.
    .ActiveConnection = cnPubs
    ' Extract the required records.
    .Open "SELECT * FROM Authors"
    ' Copy the records into cell A1 on Sheet1.
    Sheet1.Range("A1").CopyFromRecordset rsPubs
    ' Tidy up
End With

Set rsPubs = Nothing
Set cnPubs = Nothing

End Sub

It works fine,

i have saved it as an add in and can view it from the tools
bar menu.

But it is not visible in under the format tool bar.

How should i proceed?

Question by:SirReadAlot
  • 2
LVL 65

Expert Comment

ID: 16831848
Format toolbar - do u mean customize? Dont u need to create your own toolbar first?
LVL 65

Accepted Solution

rockiroads earned 2000 total points
ID: 16831861
Not sure if thats what u meant, if so, I guess u right click on any toolbar, click Customize, select the Toolbar tab, click New
then drag your commands to your new toolbar

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Six Sigma Control Plans

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question