ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   want to create utility for excel sheet!!!!! (https://www.excelbanter.com/excel-programming/351610-want-create-utility-excel-sheet.html)

.NetProf

want to create utility for excel sheet!!!!!
 
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



Bob Phillips[_6_]

want to create utility for excel sheet!!!!!
 
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)

".NetProf" wrote in message
...
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





.NetProf

want to create utility for excel sheet!!!!!
 
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
"Bob Phillips" wrote in message
...
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)

".NetProf" wrote in message
...
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







Bob Phillips[_6_]

want to create utility for excel sheet!!!!!
 
Sorry not me, I don't do c#.

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

".NetProf" wrote in message
...
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
"Bob Phillips" wrote in message
...
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)

".NetProf" wrote in message
...
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










All times are GMT +1. The time now is 07:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com