Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Assign hyperlink to new commandbar control


I trust this has not been asked recently and I've mised it in my search

I am creating a new popup on the main Excel toolbar through an auto-open
macro.

Whenit comes to the "on action" for the command bar buttons on this popup i
want to be able to assign a hyperlink just as I would if I were using the
"customize" process, right-clicking on the object and selecting "assign
hyperlink". The hyperlink is required to take user to a file located on our
network.

I'm running up blind alleys trying to find out how to do this and would
appreciate any help

Regards

Michael Bond

Copy of sample code :
Sub auto_open()

Set fbMenuBar = CommandBars.ActiveMenuBar

Count = 0
For Each c In fbMenuBar.Controls
Count = Count + 1
Next

Set fbMenu = fbMenuBar.Controls.Add(Type:=msoControlPopup, Befo=Count-1,
Temporary:=True)
fbMenu.Caption = "Football"

Set ctrl1 = fbMenu.Controls.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "Fixtures"
ctrl1.TooltipText = "Fixtures"
ctrl1.Style = msoButtonCaption
ctrl1.OnAction = ?????

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Assign hyperlink to new commandbar control

Michael,

You need to assign a macro, which can open the file:

Sub GetFile()
Workbooks.Open FileName:="Drive:\Folder 1\Folder2\File Name.xls"
End Sub

HTH,
Bernie
MS Excel MVP


"mabond" wrote in message
...

I trust this has not been asked recently and I've mised it in my search

I am creating a new popup on the main Excel toolbar through an auto-open
macro.

Whenit comes to the "on action" for the command bar buttons on this popup i
want to be able to assign a hyperlink just as I would if I were using the
"customize" process, right-clicking on the object and selecting "assign
hyperlink". The hyperlink is required to take user to a file located on our
network.

I'm running up blind alleys trying to find out how to do this and would
appreciate any help

Regards

Michael Bond

Copy of sample code :
Sub auto_open()

Set fbMenuBar = CommandBars.ActiveMenuBar

Count = 0
For Each c In fbMenuBar.Controls
Count = Count + 1
Next

Set fbMenu = fbMenuBar.Controls.Add(Type:=msoControlPopup, Befo=Count-1,
Temporary:=True)
fbMenu.Caption = "Football"

Set ctrl1 = fbMenu.Controls.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "Fixtures"
ctrl1.TooltipText = "Fixtures"
ctrl1.Style = msoButtonCaption
ctrl1.OnAction = ?????

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Assign hyperlink to new commandbar control

Bernie

I was worried that might be the response.

The commandbar.controls which will be added through the "auto-open" will
point to different files depending on the date the user opens the file (and
there may be more than 1).

Macro(s) to open the file(s) selected will not exist at the time the
application is designed. Other processing (not applicable to the user) will,
from time to time, create the files and the user will only be able to see on
the menu those files that have a date later than "now".

In order to assign macros to the "On Action" event I will have to get the
app to write the code at run time which will be assigned to the control. I
wanted to use a hyperlink rather than a macro for two reasons 1, I haven't
arrived at the point in my learning of using code to write a code module at
run time 2. I thought it would be neater.

But if that is the only way forward I'll press on and expand my learning.

Thanks for the help

Regards

Michael Bond

"Bernie Deitrick" wrote:

Michael,

You need to assign a macro, which can open the file:

Sub GetFile()
Workbooks.Open FileName:="Drive:\Folder 1\Folder2\File Name.xls"
End Sub

HTH,
Bernie
MS Excel MVP


"mabond" wrote in message
...

I trust this has not been asked recently and I've mised it in my search

I am creating a new popup on the main Excel toolbar through an auto-open
macro.

Whenit comes to the "on action" for the command bar buttons on this popup i
want to be able to assign a hyperlink just as I would if I were using the
"customize" process, right-clicking on the object and selecting "assign
hyperlink". The hyperlink is required to take user to a file located on our
network.

I'm running up blind alleys trying to find out how to do this and would
appreciate any help

Regards

Michael Bond

Copy of sample code :
Sub auto_open()

Set fbMenuBar = CommandBars.ActiveMenuBar

Count = 0
For Each c In fbMenuBar.Controls
Count = Count + 1
Next

Set fbMenu = fbMenuBar.Controls.Add(Type:=msoControlPopup, Befo=Count-1,
Temporary:=True)
fbMenu.Caption = "Football"

Set ctrl1 = fbMenu.Controls.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "Fixtures"
ctrl1.TooltipText = "Fixtures"
ctrl1.Style = msoButtonCaption
ctrl1.OnAction = ?????

End Sub




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Assign hyperlink to new commandbar control

Bernie

Forget my earlier reply .... wasn't thinking straight. I'll write a sub
routine and pass the caption of the control to the sub-routine as the file to
be opened .... couldn't be simpler

Thanks for pointing me in the right direction

Michael


"Bernie Deitrick" wrote:

Michael,

You need to assign a macro, which can open the file:

Sub GetFile()
Workbooks.Open FileName:="Drive:\Folder 1\Folder2\File Name.xls"
End Sub

HTH,
Bernie
MS Excel MVP


"mabond" wrote in message
...

I trust this has not been asked recently and I've mised it in my search

I am creating a new popup on the main Excel toolbar through an auto-open
macro.

Whenit comes to the "on action" for the command bar buttons on this popup i
want to be able to assign a hyperlink just as I would if I were using the
"customize" process, right-clicking on the object and selecting "assign
hyperlink". The hyperlink is required to take user to a file located on our
network.

I'm running up blind alleys trying to find out how to do this and would
appreciate any help

Regards

Michael Bond

Copy of sample code :
Sub auto_open()

Set fbMenuBar = CommandBars.ActiveMenuBar

Count = 0
For Each c In fbMenuBar.Controls
Count = Count + 1
Next

Set fbMenu = fbMenuBar.Controls.Add(Type:=msoControlPopup, Befo=Count-1,
Temporary:=True)
fbMenu.Caption = "Football"

Set ctrl1 = fbMenu.Controls.Add(Type:=msoControlButton, ID:=1)
ctrl1.Caption = "Fixtures"
ctrl1.TooltipText = "Fixtures"
ctrl1.Style = msoButtonCaption
ctrl1.OnAction = ?????

End Sub




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
Can a CommandBar Control Caption be Formatted ? RAFAAJ2000[_2_] Excel Programming 5 July 10th 05 08:16 AM
How control where the CommandBar will be placed? Gunnar Johansson[_5_] Excel Programming 4 May 9th 05 04:07 AM
create commandbar / control button using codes tango Excel Programming 0 October 26th 04 01:38 AM
commandbar control and application.caller Doug Glancy Excel Programming 3 March 1st 04 09:47 AM
Add control to commandbar Dan[_20_] Excel Programming 2 August 27th 03 04:47 PM


All times are GMT +1. The time now is 12:54 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"