M
Mark Milliman
I need to convert a function borrowed from Sue to VBScript but I am far from
a VB expert. I know that it should be a simple job, but FrontPage says that
there is a syntax error. The problem is that the line numbers do not match
where the error is located. The VB function runs fine in the VBE but not in
a web page in Outlook.
The subroutine that calls the function works well without the function so I
know that the problem has to lie in the function. Here is my hacked version
of the code.
Function Set_Account(AccountName, M)
Dim OLI 'As Outlook.Inspector
Dim strAccountBtnName 'As String
Dim intLoc 'As Integer
' Const ID_ACCOUNTS = 31224
Dim CBs 'As Office.CommandBars
Dim CBP 'As Office.CommandBarPopup
Dim MC 'As Office.CommandBarControl
Set OLI = M.GetInspector
If Not OLI Is Nothing Then
Set CBs = OLI.CommandBars
Set CBP = CBs.FindControl(, 31224)
If Not CBP Is Nothing Then
For Each MC In CBP.Controls
intLoc = InStr(MC.Caption, " ")
If intLoc > 0 Then
strAccountBtnName = Mid(MC.Caption, intLoc + 1)
Else
strAccountBtnName = MC.Caption
End If
If strAccountBtnName = AccountName Then
MC.Execute
Set_Account = AccountName
GoTo Exit_Function
End If
Next
End If
End If
Set_Account = ""
Exit_Function:
Set MC = Nothing
Set CBP = Nothing
Set CBs = Nothing
Set OLI = Nothing
End Function
I hate to keep bugging Sue because she has already provided so much help on
this minor front-end of the project. I hope that someone can tell me where
I have gone wrong.
Thanks,
________________________________
Mark Milliman
Longmont, Colorado E-mail: (e-mail address removed)
________________________________
a VB expert. I know that it should be a simple job, but FrontPage says that
there is a syntax error. The problem is that the line numbers do not match
where the error is located. The VB function runs fine in the VBE but not in
a web page in Outlook.
The subroutine that calls the function works well without the function so I
know that the problem has to lie in the function. Here is my hacked version
of the code.
Function Set_Account(AccountName, M)
Dim OLI 'As Outlook.Inspector
Dim strAccountBtnName 'As String
Dim intLoc 'As Integer
' Const ID_ACCOUNTS = 31224
Dim CBs 'As Office.CommandBars
Dim CBP 'As Office.CommandBarPopup
Dim MC 'As Office.CommandBarControl
Set OLI = M.GetInspector
If Not OLI Is Nothing Then
Set CBs = OLI.CommandBars
Set CBP = CBs.FindControl(, 31224)
If Not CBP Is Nothing Then
For Each MC In CBP.Controls
intLoc = InStr(MC.Caption, " ")
If intLoc > 0 Then
strAccountBtnName = Mid(MC.Caption, intLoc + 1)
Else
strAccountBtnName = MC.Caption
End If
If strAccountBtnName = AccountName Then
MC.Execute
Set_Account = AccountName
GoTo Exit_Function
End If
Next
End If
End If
Set_Account = ""
Exit_Function:
Set MC = Nothing
Set CBP = Nothing
Set CBs = Nothing
Set OLI = Nothing
End Function
I hate to keep bugging Sue because she has already provided so much help on
this minor front-end of the project. I hope that someone can tell me where
I have gone wrong.
Thanks,
________________________________
Mark Milliman
Longmont, Colorado E-mail: (e-mail address removed)
________________________________