want to create utility for excel sheet!!!!!

N

.NetProf

Hi Grp,

I want to create an utility for uploading data ( data which needs to be
fetched from any database)onto the excel sheet and after making changes into
the data, i also want it to store the chages into database. Is there a way
to create a addin sort of thing which would be available in excel menu( say
addin name is "Upload Data" ) and after clicking that addin all the data
gets uploaded onto the excel sheet. Once the data gets uploaded, addin name
gets change to "Save Data" and after clickin it, it should save the changes
to database.

Waiting for reply...

-Deepak
 
B

Bob Phillips

Yes it is certainly possible. What you need is an addin with a custom menu.
Like this

Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.CommandBars("Worksheet Menu Bar") _
.Controls("Data Manager").Delete
On Error GoTo 0
End Sub

Private Sub Workbook_Open()
Dim oCb As CommandBar
Dim oCtl As CommandBarPopup
Dim oCtlBtn As CommandBarButton

On Error Resume Next
Application.CommandBars("Worksheet Menu Bar") _
.Controls("Data Manager").Delete
On Error GoTo 0

Set oCb = Application.CommandBars("Worksheet Menu Bar")
With oCb
Set oCtl = .Controls.Add(Type:=msoControlPopup, _
temporary:=True)
oCtl.Caption = "Data Manager"
With oCtl
Set oCtlBtn = .Controls.Add( _
Type:=msoControlButton, _
temporary:=True)
oCtlBtn.Caption = "Upload Data"
oCtlBtn.OnAction = "Upload"
End With
With oCtl
Set oCtlBtn = .Controls.Add( _
Type:=msoControlButton, _
temporary:=True)
oCtlBtn.Caption = "Save Data"
oCtlBtn.OnAction = "SaveData"
End With
'etc.
End With
End Sub

'To add this, go to the VB IDE (ALT-F11 from Excel), and in
'the explorer pane, select your workbook. Then select the
'ThisWorkbook object (it's in Microsoft Excel Objects which
'might need expanding). Double-click the ThisWorkbook and
'a code window will open up. Copy this code into there,
'changing the caption and action to suit.



--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 
N

.NetProf

Thanks Bob.
I got the logic which u ve implemented but I am facing pb. while
implementing the same logic using c#.
So could you plse provide me a logic or any site ptr where I can get c#
code.

-Deepak
 
B

Bob Phillips

Sorry not me, I don't do c#.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top