Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Choose (open) workbook for actions on user prompt


Hello,

The headline might not be very descriptive. My question is:
How can i get excel to recognize or let user choose, which open
workbook to process with macro, if this workbook has differing name
from time to time.
The macro now uses the "open" function, to open a workbook of choice
and then perform actions, however i i want a different action
performed(all is in user forms), i must close the workbook again. How
can i give the user the option to choose an open workbook/window while
in a sort of user form? I do not wish for something where the user has
to select a cell in the workbook and then run macro, but rather run
userform then select.

Thank You!


--
erikhs
------------------------------------------------------------------------
erikhs's Profile: http://www.excelforum.com/member.php...o&userid=32788
View this thread: http://www.excelforum.com/showthread...hreadid=542427

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Choose (open) workbook for actions on user prompt

Create an Userform (UserForm1)
Add a ListBox (ListBox1)
Add a Command Button (CommandButton1) with caption "OK"

Paste the following code in Userform code:

'------------
Private Sub CommandButton1_Click()
MsgBox ListBox1.Value
End Sub

Private Sub UserForm_Initialize()
Dim wb As Workbook
With ListBox1
For Each wb In Workbooks
If wb.Name < ThisWorkbook.Name Then
.AddItem (wb.Name)
End If
Next wb
.ListIndex = 1
End With
End Sub
'---------------------

Et voilà!

HTH
--
AP

"erikhs" a écrit dans
le message de news: ...

Hello,

The headline might not be very descriptive. My question is:
How can i get excel to recognize or let user choose, which open
workbook to process with macro, if this workbook has differing name
from time to time.
The macro now uses the "open" function, to open a workbook of choice
and then perform actions, however i i want a different action
performed(all is in user forms), i must close the workbook again. How
can i give the user the option to choose an open workbook/window while
in a sort of user form? I do not wish for something where the user has
to select a cell in the workbook and then run macro, but rather run
userform then select.

Thank You!


--
erikhs
------------------------------------------------------------------------
erikhs's Profile:
http://www.excelforum.com/member.php...o&userid=32788
View this thread: http://www.excelforum.com/showthread...hreadid=542427



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Choose (open) workbook for actions on user prompt


Thank you!

I will try this when i get the time.


--
erikhs
------------------------------------------------------------------------
erikhs's Profile: http://www.excelforum.com/member.php...o&userid=32788
View this thread: http://www.excelforum.com/showthread...hreadid=542427

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
how do i set up a user prompt at the start of an excel workbook ? Mark Excel Worksheet Functions 1 February 11th 10 10:04 AM
Prompt user on automatic updates for Workbook Links Rob Moore Excel Discussion (Misc queries) 0 February 10th 09 02:43 PM
When I open a workbook, how can I choose which worksheet opens? josephdmcc Excel Worksheet Functions 1 April 12th 06 04:59 PM
User prompt - Open file - Perform action erikhs[_4_] Excel Programming 4 April 11th 06 01:55 PM
workbook open read only without prompt turbogoat Excel Programming 1 August 26th 04 10:44 PM


All times are GMT +1. The time now is 09:37 AM.

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"