Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2008

Tip: Looking for answers? Try searching our database.

How to sort buttons

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ray C - 27 Mar 2008 15:30 GMT
I have a VBA loop that reads file names from a directory. In the end I have a
worksheet with a bunch of filename listed (plus other file info). I also add
a button on each line that allows me to open the file. It all works
fine...until the user plays around with the sorting...When columns are
sorted, everything gets sorted except the buttons. In other words, after the
user sorts, the buttons on each line open the wrong files.

Here's the code that adds the button on each line:

sht.Range("AA" & intCurrentLine).Select
With mySheet.Buttons.Add(ActiveCell.Left, ActiveCell.Top, ActiveCell.Width,
ActiveCell.Height)
       .Name = ...
       .OnAction = ...
       .Characters.Text = ...
End With

This code is inside another bigger loop that reads each file.

Thanks in advance
Ray
Tom Hutchins - 27 Mar 2008 21:54 GMT
Just a thought ... If you create hyperlinks instead of buttons on each row,
you will still get one-click functionality to open the files, and the cells
with the hyperlinks will sort normally.

Hope this helps,

Hutch

> I have a VBA loop that reads file names from a directory. In the end I have a
> worksheet with a bunch of filename listed (plus other file info). I also add
[quoted text clipped - 17 lines]
> Thanks in advance
> Ray
Ray C - 28 Mar 2008 16:04 GMT
Hi Tom,

I solved my problem with the buttons, but I like your idea better. Oh well.

Thanks anyways
Ray

> Just a thought ... If you create hyperlinks instead of buttons on each row,
> you will still get one-click functionality to open the files, and the cells
[quoted text clipped - 25 lines]
> > Thanks in advance
> > Ray
Jean-Yves TFELT - 28 Mar 2008 09:49 GMT
Hi Ray,

I use another scirpt that list all file in the search directory and adds a
hyperlink to open.
If interested, please post back.

Regards
JY

>I have a VBA loop that reads file names from a directory. In the end I have
>a
[quoted text clipped - 21 lines]
> Thanks in advance
> Ray
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.