Macro not linking

SIGNAL

New Member
Joined
Sep 11, 2014
Messages
7
Hi I have this macro which links to an external software but it is not working ,I found this macro here http://www.aussiestockforums.com/forums/showthread.php?t=27924

HTML:
Function ExcelToAB()  Dim AB As Object  Dim StockName As String  Dim ActiveDoc As Object  Dim ADS As Object  Dim SheetNo As Integer  ActiveSheet.Activate  StockName = Trim(ActiveCell.Value) 'Trim(Worksheets(1).Range("$A$2").Value)  If StockName = "" Then End  Set AB = CreateObject("Broker.Application")  Set ActiveDoc = AB.ActiveDocument  Set ADS = AB.Documents  ' set sheet number of currently active/selected AB chart tab defined in Excel Cell B2  SheetNo = Worksheets(1).Range("$B$2").Value  AB.ActiveWindow.SelectedTab = (SheetNo - 1) ' sheet of currently active AB chart  ' set symbol of excel cells A2:A7 in AmiBroker  ActiveDoc.Name = StockName  AB.RefreshAll  Set ActiveDoc = Nothing  Set ADS = Nothing  Set AB = NothingEnd FunctionPrivate Sub Worksheet_SelectionChange(ByVal Target As Range)    If Not Intersect(Target, Range("A2:A7", "B2:B2")) Is Nothing Then        func = ExcelToAB()    End If End Sub


I hit F5 macro, don't show any error .http://i.imgur.com/0ecVncO.jpg
after I hit ALT + F8 ,I can see Macros in description but no macro name and I can't "Run","Step Into","Edit"

 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
For this part of the code

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("A2:A7", "B2:B2")) Is Nothing Then
func = ExcelToAB()
End If
End Sub

you have to right click the sheet tab, select View Code and paste it in.

Then clicking in the rangeA2:A7 or B2 should cause it to run.
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,427
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top