-
Jul 7th, 2016, 07:56 AM
#1
Thread Starter
New Member
Disabling right click in an embed excel app?
okay,
So I'm wondering if there is a way to disable the right click on my embedded excel app? I have the excel embedded within a panel, and no where else on the form can you right click
Any help would be greatly appreciated!
-
Jul 7th, 2016, 07:59 AM
#2
Re: Disabling right click in an embed excel app?
An option here may be to handle right click from the workbook....
https://msdn.microsoft.com/en-us/lib.../ff192993.aspx
-
Jul 7th, 2016, 09:01 AM
#3
Thread Starter
New Member
Re: Disabling right click in an embed excel app?
The way its set up the user only has access to the form nothing else, and I've tried the workbook_BeforeRightClick but can't seem to get it to work. I want the user to be able to enter data in the work book and i set up a button to save but I want to limit them to that.
-
Jul 7th, 2016, 09:14 AM
#4
Re: Disabling right click in an embed excel app?
Originally Posted by nebby_h
The way its set up the user only has access to the form nothing else, and I've tried the workbook_BeforeRightClick but can't seem to get it to work. I want the user to be able to enter data in the work book and i set up a button to save but I want to limit them to that.
How do you actually have Excel embedded? Through a web browser control or what?
Ultimately it sounds like the typical scenario would be to restrict the actual workbook as I indicated earlier... Since you're just showing excel in your application, how would you make it work in Excel without your application... Or subscribe to the before right click event in Excel via your application and then cancel the event.
The thing that kind of sticks out to me is why not just let someone data collect on the form itself, and then export that data to an existing or new spreadsheet? Why does the Excel functionality matter at all if they are just entering and saving data?
-
Jul 7th, 2016, 10:05 AM
#5
Thread Starter
New Member
Re: Disabling right click in an embed excel app?
I have the excel embedded within a panel. The excel functionality is important because these are manual inspection sheets for part tolerances, each of these sheets is different dependent on the different parts and different operations within each part, its changes so much its not something I could set with data collection I don't think.
-
Jul 7th, 2016, 12:54 PM
#6
Re: Disabling right click in an embed excel app?
Originally Posted by nebby_h
I have the excel embedded within a panel. The excel functionality is important because these are manual inspection sheets for part tolerances, each of these sheets is different dependent on the different parts and different operations within each part, its changes so much its not something I could set with data collection I don't think.
How are you embedding the worksheet inside of a panel?
Remember, if you can dream it, you can build it . Your form could collect input and just fill it into the worksheets. Do all of your validation on the form controls and then simply insert the values into your sheet, or generate a sheet with the values from the form, etc.
-
Jul 8th, 2016, 07:11 AM
#7
Thread Starter
New Member
Re: Disabling right click in an embed excel app?
My code looks something like this:
Code:
Dim APP As New Excel.Application
Dim worksheet As Excel.Worksheet
Dim workbook As Excel.Workbook
Private Const HT_CAPTION As Integer = &H2
Private Const WM_NCLBUTTONDOWN As Integer = &HA1
Declare Auto Function SetParent Lib "user32.dll" (ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As Integer
Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Private Const WM_SYSCOMMAND As Integer = 274
Private Const SC_MAXIMIZE As Integer = 61488
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
APP = New Excel.Application
workbook = APP.Workbooks.Open("C:\Users\nhrnjez\Documents\Jobs\Job" & jobnum & "\" & opnum & "\MI1")
SetParent(APP.Hwnd, Panel1.Handle)
SendMessage(APP.Hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0)
End Sub
End Class
The issue with collecting data within the form is that there is information in regards to what kind of data to collect in the excel sheet, and I know I could just read the sheet and show it in the form but it changes its not like cells A1-A12 have the information and you input into B1-B12 and the info inside those cells changes no, the format changes all the time. Thats why I'm trying to disable the right click within the embedded excel. Question for you would it be possible to implement a macro within the excel worksheet as soon as my form opens it?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|