473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to recover selected cells in Excel

Sol
Hello,

// Version française :
Je travaille sur une appli en vb.net et mon but est de récupérer une
sélection faites par un utilisateur sur un fichier excel.

Donc en étape :

1 - Ouvrir le fichier excel, aucun problème pour ça
2 - L'utilisateur fait sa sélection
3 - L'utilisateur ferme l'aplication excel
4 - Un évenement a été exécuté et à récupéré le "range"
sélectionné

Je n'arrive pas à faire l'étape 4

J'ai éssayé de rajouter cette méthode :

Private Sub WorkbookBeforeClose(ByVal Cancel As Boolean)

Mais il ne se passe rien, j'ai lu qu'il fallait associer l'évenement
au wrokbook mais je ne sais pas comment faire.
Le code avant pour ouvrir le fichier excel :

appExcel = CreateObject("Excel.Application")
appExcel.Workbooks.Open(openFile.FileName)
appExcel.Visible = True
appExcel.EnableEvents = False

Merci d'avance

// English version :
Please excuse me in advance for my english who is certainly not
perfect.

I'm working on an application in vb.net and I want to recover a
selection made by a user on an excel sheet.

So by step :

1 - Open the Excel file, no problem it's done
2 - User made a selection
3 - User close excel application
4 - There is an event on closing and I recover the Range.

I don't know how to do the step 4.

I try to add a function :

Private Sub WorkbookBeforeClose(ByVal Cancel As Boolean)

But it doesn't do anything, maybe i forgot something...
Code before :

appExcel = CreateObject("Excel.Application")
appExcel.Workbooks.Open(openFile.FileName)
appExcel.Visible = True
appExcel.EnableEvents = False

Thx for your help

Mar 22 '06 #1
0 988

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: zxo102 | last post by:
Hi there, I need your help for python <--> excel. I want to paste selected cells (range) to different location on the same sheet in Excel through python. I have tried it for a while but could not...
5
by: mrid via DotNetMonster.com | last post by:
hi. im exporting data from a vb form to excel. i am able to create a new excel file, save and edit it without any trouble, but the formatting is giving me hell! i need to be able to show certain...
1
by: mgoold2002 | last post by:
I'm moving some code from Excel vbs into a .NET context and I'm very new to .NET. I'm trying to make this Excel vb code work in .NET. My questions are: how do I reference cells correctly using...
4
by: gordon | last post by:
Hi I hav e a smallish app that has a datagridview. A user can select some columns in the datagrid, and i have a button that i would like to use to copy the rows that are selected to the...
4
by: mimasci | last post by:
Hi, I have tried to write a code that allowed me to modify the value of the cells selected in a table, with excel has been easy. How one approaches selected cells? (To modify the value) How...
0
ebs57
by: ebs57 | last post by:
Does anyone know how to easily and programmatically save a range of cells with Excel VBA to a CSV, text or other file? It would be nice if I did not have to create another worksheet first, too, but...
2
by: ManuelValdez | last post by:
Hello! I need your help to design an Excel macro to delete zeros only in selected cells. Thank you very much.
0
by: savakis | last post by:
Can onyone please help me please. I have duplicate items in column A:A which I find via combobox1. These items are placed in listbox1. I then fill in textbox1 and textbox2 for column C and D, and...
2
by: Stratocaster | last post by:
Hello, and thank you for any help in advance. I need help determining if any commands exist in VB (Excel macro style) that can enable a user to select cells and run a macro which performs...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.