PC Review


Reply
Thread Tools Rate Thread

How to determine the current position of an open .xls file?

 
 
=?Utf-8?B?QW5kcmV3?=
Guest
Posts: n/a
 
      20th Mar 2007
Hello, friends,

We automate Excel from C#.net. Once a .xls file is openned, users may work
on any part of it.

When this .xls file is closed, our app needs to remember the current
position, such as current workSheet, current row number, current column
number, etc. When our app opens this .xls file next time, it will go to that
position directly so that users may continue.

But, how to determine current row number, and etc. I looked up those
properties/methods, none of them look like for this job: I could not find
ActiveCell property in worksheet, for instance.

Any reference paper or sample source code? Thanks a lot.


 
Reply With Quote
 
 
 
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      20th Mar 2007
When the workbook is saved, Excel "remembers" the activesheet and activecell.
So, you can use the ActiveSheet and ActiveCell objects. As a test, put this
in the workbook code module:

Private Sub Workbook_Open()
MsgBox "Current location: " & ActiveSheet.Name & "!" & ActiveCell.Address
End Sub




--

Hope that helps.

Vergel Adriano


"Andrew" wrote:

> Hello, friends,
>
> We automate Excel from C#.net. Once a .xls file is openned, users may work
> on any part of it.
>
> When this .xls file is closed, our app needs to remember the current
> position, such as current workSheet, current row number, current column
> number, etc. When our app opens this .xls file next time, it will go to that
> position directly so that users may continue.
>
> But, how to determine current row number, and etc. I looked up those
> properties/methods, none of them look like for this job: I could not find
> ActiveCell property in worksheet, for instance.
>
> Any reference paper or sample source code? Thanks a lot.
>
>

 
Reply With Quote
 
=?Utf-8?B?QW5kcmV3?=
Guest
Posts: n/a
 
      20th Mar 2007
Those .xls files are read only. When users work on a .xls file, he/she may
click Bookmark button in our app to bookmark wherever he/she is currently
working on. Our app then will get the current position and save them into
database.

Next time users open the same .xls again (read only), our app will list all
bookmarks to allow users to "jump onto" that position by doubl-clicking one
of them.

Any ideas? Thanks a lot.


"Vergel Adriano" wrote:

> When the workbook is saved, Excel "remembers" the activesheet and activecell.
> So, you can use the ActiveSheet and ActiveCell objects. As a test, put this
> in the workbook code module:
>
> Private Sub Workbook_Open()
> MsgBox "Current location: " & ActiveSheet.Name & "!" & ActiveCell.Address
> End Sub
>
>
>
>
> --
>
> Hope that helps.
>
> Vergel Adriano
>
>
> "Andrew" wrote:
>
> > Hello, friends,
> >
> > We automate Excel from C#.net. Once a .xls file is openned, users may work
> > on any part of it.
> >
> > When this .xls file is closed, our app needs to remember the current
> > position, such as current workSheet, current row number, current column
> > number, etc. When our app opens this .xls file next time, it will go to that
> > position directly so that users may continue.
> >
> > But, how to determine current row number, and etc. I looked up those
> > properties/methods, none of them look like for this job: I could not find
> > ActiveCell property in worksheet, for instance.
> >
> > Any reference paper or sample source code? Thanks a lot.
> >
> >

 
Reply With Quote
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      20th Mar 2007
In that case, it looks like persisting the bookmarks in a text file like an
INI file or the Registry might be your options. Check out the link below
which shows how to work with INI files.

http://www.exceltip.com/st/Private_P...Excel/490.html



--
Hope that helps.

Vergel Adriano


"Andrew" wrote:

> Those .xls files are read only. When users work on a .xls file, he/she may
> click Bookmark button in our app to bookmark wherever he/she is currently
> working on. Our app then will get the current position and save them into
> database.
>
> Next time users open the same .xls again (read only), our app will list all
> bookmarks to allow users to "jump onto" that position by doubl-clicking one
> of them.
>
> Any ideas? Thanks a lot.
>
>
> "Vergel Adriano" wrote:
>
> > When the workbook is saved, Excel "remembers" the activesheet and activecell.
> > So, you can use the ActiveSheet and ActiveCell objects. As a test, put this
> > in the workbook code module:
> >
> > Private Sub Workbook_Open()
> > MsgBox "Current location: " & ActiveSheet.Name & "!" & ActiveCell.Address
> > End Sub
> >
> >
> >
> >
> > --
> >
> > Hope that helps.
> >
> > Vergel Adriano
> >
> >
> > "Andrew" wrote:
> >
> > > Hello, friends,
> > >
> > > We automate Excel from C#.net. Once a .xls file is openned, users may work
> > > on any part of it.
> > >
> > > When this .xls file is closed, our app needs to remember the current
> > > position, such as current workSheet, current row number, current column
> > > number, etc. When our app opens this .xls file next time, it will go to that
> > > position directly so that users may continue.
> > >
> > > But, how to determine current row number, and etc. I looked up those
> > > properties/methods, none of them look like for this job: I could not find
> > > ActiveCell property in worksheet, for instance.
> > >
> > > Any reference paper or sample source code? Thanks a lot.
> > >
> > >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to determine the current cursor position in the selection of a doodleM Microsoft Powerpoint 1 10th May 2010 07:22 PM
Function to determine current cursor position? Dan Microsoft Excel Worksheet Functions 1 12th Mar 2009 02:56 PM
Determine if current database is open exclusively. =?Utf-8?B?U3R1YXJ0TQ==?= Microsoft Access Security 2 23rd May 2005 09:46 AM
how to open application at Current Caret position Omer Kamal Microsoft C# .NET 0 30th Mar 2005 10:48 AM
How to determine which PST file current be used? Hunte Swee Microsoft Outlook 1 25th Dec 2003 03:24 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:45 PM.