Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default ListBox/ComboBox Acting as Macro/Hyperlink Tool

Is it possible have a List Box or Combo Box act as a macro and/or hyperlink
tool, such that when the user highlights one of the choices and clicks on it,
the selected text appears in the LB or CB, and the macro or hyperlink is
executed?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default ListBox/ComboBox Acting as Macro/Hyperlink Tool

Phil,
You have the _Click and _Change events for these controls where you can run
whatever code you require.

NickHK

"Phil H" wrote in message
...
Is it possible have a List Box or Combo Box act as a macro and/or

hyperlink
tool, such that when the user highlights one of the choices and clicks on

it,
the selected text appears in the LB or CB, and the macro or hyperlink is
executed?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default ListBox/ComboBox Acting as Macro/Hyperlink Tool

Hi Nick,

Thanks for your reply - glad to know this is possible.

Using Excel 2003. Can you help me set this up? I want to set up either a
LB or CB, don't know which is preferable, here to move users by macro to
other worksheets within a workbook, or by hyperlink to documents outside the
document - I need both capabilities in one tool. Below is a typical macro
I'm using to move within the workbook. Can you help me set up this tool code?

Thanks, Phil

Sub GoToREP003()
Application.ScreenUpdating = False
Sheets("REP003").Select
Application.Goto Reference:=Range("A1"), Scroll:=True
Application.Goto Reference:=Range("A100"), Scroll:=False
ActiveWindow.Zoom = 84
Application.ScreenUpdating = True
End Sub




"NickHK" wrote:

Phil,
You have the _Click and _Change events for these controls where you can run
whatever code you require.

NickHK

"Phil H" wrote in message
...
Is it possible have a List Box or Combo Box act as a macro and/or

hyperlink
tool, such that when the user highlights one of the choices and clicks on

it,
the selected text appears in the LB or CB, and the macro or hyperlink is
executed?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default ListBox/ComboBox Acting as Macro/Hyperlink Tool

Phil,
What are you putting in the LB/CB to indicate the destination ?
Assuming it is filled from a range called "LinkList" that contains all the
hyperlinks, you could:
Range(LinkList).Hyperlinks(List1.Index + 1).Follow....

I don't use hyperlink etc much, but something along these lines should work.

NickHK

"Phil H" wrote in message
...
Hi Nick,

Thanks for your reply - glad to know this is possible.

Using Excel 2003. Can you help me set this up? I want to set up either a
LB or CB, don't know which is preferable, here to move users by macro to
other worksheets within a workbook, or by hyperlink to documents outside

the
document - I need both capabilities in one tool. Below is a typical macro
I'm using to move within the workbook. Can you help me set up this tool

code?

Thanks, Phil

Sub GoToREP003()
Application.ScreenUpdating = False
Sheets("REP003").Select
Application.Goto Reference:=Range("A1"), Scroll:=True
Application.Goto Reference:=Range("A100"), Scroll:=False
ActiveWindow.Zoom = 84
Application.ScreenUpdating = True
End Sub




"NickHK" wrote:

Phil,
You have the _Click and _Change events for these controls where you can

run
whatever code you require.

NickHK

"Phil H" wrote in message
...
Is it possible have a List Box or Combo Box act as a macro and/or

hyperlink
tool, such that when the user highlights one of the choices and clicks

on
it,
the selected text appears in the LB or CB, and the macro or hyperlink

is
executed?






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default ListBox/ComboBox Acting as Macro/Hyperlink Tool

Nick,

To simplify this conversation, lets use a Combo Box. As I understand a CB,
I would have, for example, four lines (set up in the LinkedCell,
ListFillRange) with the text of the destination document. To illustrate:

For ComboBox1: LinkedCell is K89, ListFillRange is K91:K94

Cell ListFillRange Text Hyperlink/Macro Execute
K91 Policy ABC C:\Policies\Policy ABC
K92 Instruction XYZ Sub GoToXYZ()
K93 Note TUV K:\Notes\Note TUV
K94 Directive HIJ Sub GoToHIJ()

If the user selects €śNote TUV€ť from the CB, €śNote TUV€ť would appear in the
CB as usual, and Excel would execute the hyperlink. If €śInstruction XYZ€ť
were selected, "Instruction XYZ" would appear in the CB and the macro
GoToXYZ() would execute. The hyperlink/Sub could be set up in another cell,
say P91:P94.

Nick, Im really at a loss as to how to set this up. Im used to command
buttons with macros attached, but have never set up a CB to do this. Im not
sure that setting up LinkedCell and ListFillRange is the answer either, but I
think I read about this a long time ago in an Excel news group somewhere -
but I couldnt find anything on it. Any help is greatly appreciated.

Phil

"NickHK" wrote:

Phil,
What are you putting in the LB/CB to indicate the destination ?
Assuming it is filled from a range called "LinkList" that contains all the
hyperlinks, you could:
Range(LinkList).Hyperlinks(List1.Index + 1).Follow....

I don't use hyperlink etc much, but something along these lines should work.

NickHK

"Phil H" wrote in message
...
Hi Nick,

Thanks for your reply - glad to know this is possible.

Using Excel 2003. Can you help me set this up? I want to set up either a
LB or CB, don't know which is preferable, here to move users by macro to
other worksheets within a workbook, or by hyperlink to documents outside

the
document - I need both capabilities in one tool. Below is a typical macro
I'm using to move within the workbook. Can you help me set up this tool

code?

Thanks, Phil

Sub GoToREP003()
Application.ScreenUpdating = False
Sheets("REP003").Select
Application.Goto Reference:=Range("A1"), Scroll:=True
Application.Goto Reference:=Range("A100"), Scroll:=False
ActiveWindow.Zoom = 84
Application.ScreenUpdating = True
End Sub




"NickHK" wrote:

Phil,
You have the _Click and _Change events for these controls where you can

run
whatever code you require.

NickHK

"Phil H" wrote in message
...
Is it possible have a List Box or Combo Box act as a macro and/or
hyperlink
tool, such that when the user highlights one of the choices and clicks

on
it,
the selected text appears in the LB or CB, and the macro or hyperlink

is
executed?








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default ListBox/ComboBox Acting as Macro/Hyperlink Tool

Phil,
As far as I see it, if you have a variety of actions (hyperlink, macro,
etc), depending on the selection, some sort of branching would be required.
You could have a couple of helper columns e.g.
TextToAppearInCB Action Value
K91 Policy ABC HLink C:\Policies\Policy ABC
K92 Instruction XYZ Macro GoToXYZ()
K93 Note TUV HLink K:\Notes\Note TUV
K94 Directive HIJ Macro GoToHIJ()

So in the CB_Click event, find the action that corresponds to the selected
value and branch accordingly:

With Range("K91")
Select Case LCase(.Offset(CB.ListIndex,1).Value)
Case "hlink"
'follow the hyperlink of value=Offset(CB.ListIndex,2).Value
Case "macro"
'run the macro of value=Offset(CB.ListIndex,2).Value
Case Else
'whatever...
End Select
End with

NickHK

"Phil H" wrote in message
...
Nick,

To simplify this conversation, let's use a Combo Box. As I understand a

CB,
I would have, for example, four lines (set up in the LinkedCell,
ListFillRange) with the text of the destination document. To illustrate:

For ComboBox1: LinkedCell is K89, ListFillRange is K91:K94

Cell ListFillRange Text Hyperlink/Macro Execute
K91 Policy ABC C:\Policies\Policy ABC
K92 Instruction XYZ Sub GoToXYZ()
K93 Note TUV K:\Notes\Note TUV
K94 Directive HIJ Sub GoToHIJ()

If the user selects "Note TUV" from the CB, "Note TUV" would appear in the
CB as usual, and Excel would execute the hyperlink. If "Instruction XYZ"
were selected, "Instruction XYZ" would appear in the CB and the macro
GoToXYZ() would execute. The hyperlink/Sub could be set up in another

cell,
say P91:P94.

Nick, I'm really at a loss as to how to set this up. I'm used to command
buttons with macros attached, but have never set up a CB to do this. I'm

not
sure that setting up LinkedCell and ListFillRange is the answer either,

but I
think I read about this a long time ago in an Excel news group somewhere -
but I couldn't find anything on it. Any help is greatly appreciated.

Phil

"NickHK" wrote:

Phil,
What are you putting in the LB/CB to indicate the destination ?
Assuming it is filled from a range called "LinkList" that contains all

the
hyperlinks, you could:
Range(LinkList).Hyperlinks(List1.Index + 1).Follow....

I don't use hyperlink etc much, but something along these lines should

work.

NickHK

"Phil H" wrote in message
...
Hi Nick,

Thanks for your reply - glad to know this is possible.

Using Excel 2003. Can you help me set this up? I want to set up

either a
LB or CB, don't know which is preferable, here to move users by macro

to
other worksheets within a workbook, or by hyperlink to documents

outside
the
document - I need both capabilities in one tool. Below is a typical

macro
I'm using to move within the workbook. Can you help me set up this

tool
code?

Thanks, Phil

Sub GoToREP003()
Application.ScreenUpdating = False
Sheets("REP003").Select
Application.Goto Reference:=Range("A1"), Scroll:=True
Application.Goto Reference:=Range("A100"), Scroll:=False
ActiveWindow.Zoom = 84
Application.ScreenUpdating = True
End Sub




"NickHK" wrote:

Phil,
You have the _Click and _Change events for these controls where you

can
run
whatever code you require.

NickHK

"Phil H" wrote in message
...
Is it possible have a List Box or Combo Box act as a macro and/or
hyperlink
tool, such that when the user highlights one of the choices and

clicks
on
it,
the selected text appears in the LB or CB, and the macro or

hyperlink
is
executed?








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
Combobox/Listbox Difference WLMPilot Excel Discussion (Misc queries) 1 November 21st 06 01:46 PM
comboBox vs Listbox Steve Excel Programming 2 March 14th 06 12:23 AM
Combobox v Listbox MBlake New Users to Excel 5 April 24th 05 11:58 AM
Combobox/listbox FSt1 Excel Discussion (Misc queries) 3 January 4th 05 06:55 PM
Combobox or Listbox Kathy[_7_] Excel Programming 2 December 4th 03 03:48 PM


All times are GMT +1. The time now is 08:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"