Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.vb.winapi,microsoft.public.vb.general.discussion
external usenet poster
 
Posts: 97
Default How to read active Excel celll value by external vb application?

Hello,
I've asked that question before but that thread appears dead now.
My applications is developed in vbasic5.
I need for it to get Windows notification when user clicks on the cell and
retrieve the cell value.

I did exactly as Rob van Gelder advised me in the another thread.
1. I installed Excel and load the reference to Excel Object Library in my
vbasic5 code.
2. I created Class1 module and put the following code in there.
---------------
Public WithEvents app As Excel.Application

Private Sub app_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)
MsgBox "Selection Changed"
End Sub
--------------------
3. I put the another code in Form_Load of my app:
--------------------
Dim cls As New Class1, wkb As Excel.Workbook

Set cls.app = New Excel.Application

Set wkb = cls.app.Workbooks.Add
wkb.Worksheets(1).Cells(10, 10).Select
MsgBox ActiveCell.Value
wkb.Close
cls.app.Quit
Set cls.app = Nothing
Set cls = Nothing
-------------------

When I start my app I have message: "Selection changed" (although I did
nothing to my Excel sheet) followed by the empty message box (MsgBox
ActiveCell.Value).
When I select another cell in Excel there is not any notification my app is
aware of.
It looks like ActiveCell.Value is not able to retrieve the cell value

What I need is:
1. Get notified the user clicked on Excel cell
2. Retrieve the value of that cell

Please help,
Jack

"Rob van Gelder" wrote in message
...
Jack,

You'll probably need a reference to Excel Object Library.

To answer your other e-mail

In a class module (in this example called Class1)
Public WithEvents app As Excel.Application

Private Sub app_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)
MsgBox "Selection Changed"
End Sub


Then somewhere in your code:
Sub test()
Dim cls As New Class1, wkb As Excel.Workbook

Set cls.app = New Excel.Application

Set wkb = cls.app.Workbooks.Add
wkb.Worksheets(1).Cells(10, 10).Select

wkb.Close
cls.app.Quit
Set cls.app = Nothing
Set cls = Nothing
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Jack" <replyto@newsgroup wrote in message
...
Thank you, but I need more help.
I tried your line in my vbasic5 but it is complaining about ActiveCell

:
"Variable not defined"
I guess I need to load some reference or component. What is it?
Jack

"Rob van Gelder" wrote in

message
...
Jack,

MsgBox ActiveCell.Value


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Jack" <replyto@newsgroup wrote in message
...
Hello,
I am not user of Excel and I am not familiar with it at

all.
I am programming in visual basic 5 and I've never used VBA.
For my vbasic5 code I need to retrieve the content of the Excel cell

user
has clicked on.
Please advise how can I do that.




  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.vb.winapi,microsoft.public.vb.general.discussion
external usenet poster
 
Posts: 1
Default How to read active Excel celll value by external vb application?

it looks like the lines
wkb.Worksheets(1).Cells(10, 10).Select
MsgBox ActiveCell.Value
are programatically selecting the cell I 10 and showing the value of that
try putting something in i10 and see if it gives you a value

Pete
"Jack" <replyto@newsgroup wrote in message
...
Hello,
I've asked that question before but that thread appears dead

now.
My applications is developed in vbasic5.
I need for it to get Windows notification when user clicks on the cell and
retrieve the cell value.

I did exactly as Rob van Gelder advised me in the another thread.
1. I installed Excel and load the reference to Excel Object Library in my
vbasic5 code.
2. I created Class1 module and put the following code in there.
---------------
Public WithEvents app As Excel.Application

Private Sub app_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)
MsgBox "Selection Changed"
End Sub
--------------------
3. I put the another code in Form_Load of my app:
--------------------
Dim cls As New Class1, wkb As Excel.Workbook

Set cls.app = New Excel.Application

Set wkb = cls.app.Workbooks.Add
wkb.Worksheets(1).Cells(10, 10).Select
MsgBox ActiveCell.Value
wkb.Close
cls.app.Quit
Set cls.app = Nothing
Set cls = Nothing
-------------------

When I start my app I have message: "Selection changed" (although I did
nothing to my Excel sheet) followed by the empty message box (MsgBox
ActiveCell.Value).
When I select another cell in Excel there is not any notification my app

is
aware of.
It looks like ActiveCell.Value is not able to retrieve the cell value

What I need is:
1. Get notified the user clicked on Excel cell
2. Retrieve the value of that cell

Please help,
Jack

"Rob van Gelder" wrote in message
...
Jack,

You'll probably need a reference to Excel Object Library.

To answer your other e-mail

In a class module (in this example called Class1)
Public WithEvents app As Excel.Application

Private Sub app_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)
MsgBox "Selection Changed"
End Sub


Then somewhere in your code:
Sub test()
Dim cls As New Class1, wkb As Excel.Workbook

Set cls.app = New Excel.Application

Set wkb = cls.app.Workbooks.Add
wkb.Worksheets(1).Cells(10, 10).Select

wkb.Close
cls.app.Quit
Set cls.app = Nothing
Set cls = Nothing
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Jack" <replyto@newsgroup wrote in message
...
Thank you, but I need more help.
I tried your line in my vbasic5 but it is complaining about

ActiveCell
:
"Variable not defined"
I guess I need to load some reference or component. What is it?
Jack

"Rob van Gelder" wrote in

message
...
Jack,

MsgBox ActiveCell.Value


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Jack" <replyto@newsgroup wrote in message
...
Hello,
I am not user of Excel and I am not familiar with it at

all.
I am programming in visual basic 5 and I've never used VBA.
For my vbasic5 code I need to retrieve the content of the Excel

cell
user
has clicked on.
Please advise how can I do that.






  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.vb.winapi,microsoft.public.vb.general.discussion
external usenet poster
 
Posts: 97
Default How to read active Excel celll value by external vb application?

Thank you, Pete.
I know how to retrieve cell value now.
Do you know how to get Windows notification that user has selected another
cell (that another cell has became ACTIVE)?
My code is already hooked up to Windows.
Jack

"Pete Winnard" wrote in message
...
it looks like the lines
wkb.Worksheets(1).Cells(10, 10).Select
MsgBox ActiveCell.Value
are programatically selecting the cell I 10 and showing the value of that
try putting something in i10 and see if it gives you a value

Pete
"Jack" <replyto@newsgroup wrote in message
...
Hello,
I've asked that question before but that thread appears dead

now.
My applications is developed in vbasic5.
I need for it to get Windows notification when user clicks on the cell

and
retrieve the cell value.

I did exactly as Rob van Gelder advised me in the another thread.
1. I installed Excel and load the reference to Excel Object Library in

my
vbasic5 code.
2. I created Class1 module and put the following code in there.
---------------
Public WithEvents app As Excel.Application

Private Sub app_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)
MsgBox "Selection Changed"
End Sub
--------------------
3. I put the another code in Form_Load of my app:
--------------------
Dim cls As New Class1, wkb As Excel.Workbook

Set cls.app = New Excel.Application

Set wkb = cls.app.Workbooks.Add
wkb.Worksheets(1).Cells(10, 10).Select
MsgBox ActiveCell.Value
wkb.Close
cls.app.Quit
Set cls.app = Nothing
Set cls = Nothing
-------------------

When I start my app I have message: "Selection changed" (although I did
nothing to my Excel sheet) followed by the empty message box (MsgBox
ActiveCell.Value).
When I select another cell in Excel there is not any notification my app

is
aware of.
It looks like ActiveCell.Value is not able to retrieve the cell value

What I need is:
1. Get notified the user clicked on Excel cell
2. Retrieve the value of that cell

Please help,
Jack

"Rob van Gelder" wrote in

message
...
Jack,

You'll probably need a reference to Excel Object Library.

To answer your other e-mail

In a class module (in this example called Class1)
Public WithEvents app As Excel.Application

Private Sub app_SheetSelectionChange(ByVal Sh As Object, ByVal Target

As
Range)
MsgBox "Selection Changed"
End Sub


Then somewhere in your code:
Sub test()
Dim cls As New Class1, wkb As Excel.Workbook

Set cls.app = New Excel.Application

Set wkb = cls.app.Workbooks.Add
wkb.Worksheets(1).Cells(10, 10).Select

wkb.Close
cls.app.Quit
Set cls.app = Nothing
Set cls = Nothing
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Jack" <replyto@newsgroup wrote in message
...
Thank you, but I need more help.
I tried your line in my vbasic5 but it is complaining about

ActiveCell
:
"Variable not defined"
I guess I need to load some reference or component. What is it?
Jack

"Rob van Gelder" wrote in

message
...
Jack,

MsgBox ActiveCell.Value


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Jack" <replyto@newsgroup wrote in message
...
Hello,
I am not user of Excel and I am not familiar with it

at
all.
I am programming in visual basic 5 and I've never used VBA.
For my vbasic5 code I need to retrieve the content of the Excel

cell
user
has clicked on.
Please advise how can I do that.








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read/write excel and word 2007 documents from another application mco3006 Excel Discussion (Misc queries) 0 April 27th 10 10:18 AM
Excel cannot auto start external application Jason Falzon[_2_] Excel Discussion (Misc queries) 0 March 25th 10 08:57 AM
How to Determine if Application Window Still Active Edwin Kelly Excel Discussion (Misc queries) 3 June 26th 07 05:42 PM
VBA: Make Excel the active application Gaetan Excel Discussion (Misc queries) 0 March 19th 07 05:57 PM
Open an external application PaulW Excel Discussion (Misc queries) 8 November 16th 06 05:12 PM


All times are GMT +1. The time now is 01:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"