Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
COM Add-in in VB
Hi,
I am creating an COM Add-in in VB6 which connects to Excel. Within the COM Add-in I have made some userforms, which have to do something in the Excel-sheet. In de AddinDesigner (.dsr) I can use the Excel object to make the changes in the Excel-sheet. But in the userforms I can't connect to the Excel-object. How to handle this? I have the following code in de AddInDesigner: Option Explicit Public oXL As Excel.Application And: Private Sub AddinInstance_OnConnection(ByVal Application As Object, _ ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _ ByVal AddInInst As Object, custom() As Variant) AddInInst.object = Me Set oXL = Application So in the AddInDesigner I can use the object oXL. But how to make use of the object oXL in the userforms?? Thanks in advance. Greetings Arie |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
COM Add-in in VB
If you're trying to control a userform in an Excel workbook via automation I
don't believe that is possible. I think you have to run a macro in the Excel workbook to show a userform. etc. -- Jim "Arie" wrote in message ... | Hi, | | I am creating an COM Add-in in VB6 which connects to Excel. | | Within the COM Add-in I have made some userforms, which have to do something | in the Excel-sheet. In de AddinDesigner (.dsr) I can use the Excel object to | make the changes in the Excel-sheet. But in the userforms I can't connect to | the Excel-object. How to handle this? | | | I have the following code in de AddInDesigner: | | Option Explicit | Public oXL As Excel.Application | | And: | | Private Sub AddinInstance_OnConnection(ByVal Application As Object, _ | ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _ | ByVal AddInInst As Object, custom() As Variant) | | AddInInst.object = Me | Set oXL = Application | | So in the AddInDesigner I can use the object oXL. | | But how to make use of the object oXL in the userforms?? | | | Thanks in advance. | | Greetings Arie | | |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
COM Add-in in VB
Arie schrieb:
Hi, I am creating an COM Add-in in VB6 which connects to Excel. Within the COM Add-in I have made some userforms, which have to do something in the Excel-sheet. In de AddinDesigner (.dsr) I can use the Excel object to make the changes in the Excel-sheet. But in the userforms I can't connect to the Excel-object. How to handle this? I have the following code in de AddInDesigner: Option Explicit Public oXL As Excel.Application And: Private Sub AddinInstance_OnConnection(ByVal Application As Object, _ ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _ ByVal AddInInst As Object, custom() As Variant) AddInInst.object = Me Set oXL = Application So in the AddInDesigner I can use the object oXL. But how to make use of the object oXL in the userforms?? Thanks in advance. Greetings Arie Hi, declare your object oXL in a 'public module' (not a class). -- Thomas http://rtsoftwaredevelopment.de |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
COM Add-in in VB
The userforms are in the COM Add-in itself, so not in the Excel workbook.
In that userform I cannot use the oXL object. Arie "Jim Rech" schreef in bericht ... If you're trying to control a userform in an Excel workbook via automation I don't believe that is possible. I think you have to run a macro in the Excel workbook to show a userform. etc. -- Jim "Arie" wrote in message ... | Hi, | | I am creating an COM Add-in in VB6 which connects to Excel. | | Within the COM Add-in I have made some userforms, which have to do something | in the Excel-sheet. In de AddinDesigner (.dsr) I can use the Excel object to | make the changes in the Excel-sheet. But in the userforms I can't connect to | the Excel-object. How to handle this? | | | I have the following code in de AddInDesigner: | | Option Explicit | Public oXL As Excel.Application | | And: | | Private Sub AddinInstance_OnConnection(ByVal Application As Object, _ | ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _ | ByVal AddInInst As Object, custom() As Variant) | | AddInInst.object = Me | Set oXL = Application | | So in the AddInDesigner I can use the object oXL. | | But how to make use of the object oXL in the userforms?? | | | Thanks in advance. | | Greetings Arie | | |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
COM Add-in in VB
Thanks for the response.
I tried your solution. So I set the 'Public oXL As Excel.Application' in a public module and deleted it from the AddinDesigner. When debugging I get the error 'Ambiguous name detected: oXL' on the line 'Set oXL = Application'. Any ideas? Arie "Thomas Risi" schreef in bericht ... Arie schrieb: Hi, I am creating an COM Add-in in VB6 which connects to Excel. Within the COM Add-in I have made some userforms, which have to do something in the Excel-sheet. In de AddinDesigner (.dsr) I can use the Excel object to make the changes in the Excel-sheet. But in the userforms I can't connect to the Excel-object. How to handle this? I have the following code in de AddInDesigner: Option Explicit Public oXL As Excel.Application And: Private Sub AddinInstance_OnConnection(ByVal Application As Object, _ ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _ ByVal AddInInst As Object, custom() As Variant) AddInInst.object = Me Set oXL = Application So in the AddInDesigner I can use the object oXL. But how to make use of the object oXL in the userforms?? Thanks in advance. Greetings Arie Hi, declare your object oXL in a 'public module' (not a class). -- Thomas http://rtsoftwaredevelopment.de |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
COM Add-in in VB
Arie schrieb:
Thanks for the response. I tried your solution. So I set the 'Public oXL As Excel.Application' in a public module and deleted it from the AddinDesigner. When debugging I get the error 'Ambiguous name detected: oXL' on the line 'Set oXL = Application'. Any ideas? Arie "Thomas Risi" schreef in bericht ... Arie schrieb: Hi, I am creating an COM Add-in in VB6 which connects to Excel. Within the COM Add-in I have made some userforms, which have to do something in the Excel-sheet. In de AddinDesigner (.dsr) I can use the Excel object to make the changes in the Excel-sheet. But in the userforms I can't connect to the Excel-object. How to handle this? I have the following code in de AddInDesigner: Option Explicit Public oXL As Excel.Application And: Private Sub AddinInstance_OnConnection(ByVal Application As Object, _ ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _ ByVal AddInInst As Object, custom() As Variant) AddInInst.object = Me Set oXL = Application So in the AddInDesigner I can use the object oXL. But how to make use of the object oXL in the userforms?? Thanks in advance. Greetings Arie Hi, declare your object oXL in a 'public module' (not a class). -- Thomas http://rtsoftwaredevelopment.de I just tried it, and it works fine. Modulecode ... Option Explicit Public oXl As Object Designercode ... Option Explicit Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant) Set oXl = Application Form1.Show End Sub Formcode ... Option Explicit Private Sub Command1_Click() MsgBox oXl.Name End Sub -- Thomas http://rtsoftwaredevelopment.de |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
COM Add-in in VB
I had a 'Public oXL as Excel.Application' in another userform
After deleting this it works fine. Thanks a lot! "Thomas Risi" schreef in bericht ... Arie schrieb: Thanks for the response. I tried your solution. So I set the 'Public oXL As Excel.Application' in a public module and deleted it from the AddinDesigner. When debugging I get the error 'Ambiguous name detected: oXL' on the line 'Set oXL = Application'. Any ideas? Arie "Thomas Risi" schreef in bericht ... Arie schrieb: Hi, I am creating an COM Add-in in VB6 which connects to Excel. Within the COM Add-in I have made some userforms, which have to do something in the Excel-sheet. In de AddinDesigner (.dsr) I can use the Excel object to make the changes in the Excel-sheet. But in the userforms I can't connect to the Excel-object. How to handle this? I have the following code in de AddInDesigner: Option Explicit Public oXL As Excel.Application And: Private Sub AddinInstance_OnConnection(ByVal Application As Object, _ ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _ ByVal AddInInst As Object, custom() As Variant) AddInInst.object = Me Set oXL = Application So in the AddInDesigner I can use the object oXL. But how to make use of the object oXL in the userforms?? Thanks in advance. Greetings Arie Hi, declare your object oXL in a 'public module' (not a class). -- Thomas http://rtsoftwaredevelopment.de I just tried it, and it works fine. Modulecode ... Option Explicit Public oXl As Object Designercode ... Option Explicit Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant) Set oXl = Application Form1.Show End Sub Formcode ... Option Explicit Private Sub Command1_Click() MsgBox oXl.Name End Sub -- Thomas http://rtsoftwaredevelopment.de |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|