PDA

Click to See Complete Forum and Search --> : Using selecting in Excel


michelle
Jan 25th, 2000, 04:13 PM
Dear VB users,

In my VB program I want to select in an opened Excel sheet a part of the sheet.

After the selecting the program must know what the selecting was.

How do I do that?

Knows somebody an answer?

Nice greetings,

Michelle.

Lyla
Jan 25th, 2000, 06:53 PM
Hi michelle.

Do you want to know how to open the XL object?
Also, you said "program must know what the selecting was"!, You mean the cell.values?

Please clarify with an example.

Good Luck.

michelle
Jan 26th, 2000, 05:44 PM
Hello Lyla,

I will simple explain my question:

On my form there are two command buttons

Button 1:
Private Sub CmdOpenExel_Click()
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Open ("c:\q.xls")
End Sub

With button-1 I can open the spread sheet.

With the Alt Tab key I go to the sheet and select a part of the sheet.

With the Alt Tab key I return to the form.

With button-2 I want to know what is selected in the sheet.

I hope you can help me.

Nice regards, Michelle.

JohnAtWork
Jan 27th, 2000, 11:35 AM
I'm still foggy on what you need to know regarding your second button....

do you want to know what range is selected in the application, or do you want the values in the range?

Either way, look into the Range Object. I can't remember if a user selected range returns a value, but that will set you up a little further.



[This message has been edited by JohnAtWork (edited 01-27-2000).]