Insert webbot "include" with Frontpage VBA
==============================
MY QUESTION WAS
I want an new to insert the following Tag with FP VBA to my page>
<!--webbot bot="Include" U-Include="xyz.htm" TAG="BODY" -->>
what ist the correspondant VBA Code to do this?
SOLUTION FOUND:
The solution was achieved with the CommandBars.Execute methode and the
Sendkeys funtion.
(see code below)
In don't like the Sendkeys Funktion in this circumstance.
If you have an alternative solution please tell.
(As I want to insert the Bot at the Curser position, the
"MyBody.insertAdjacentHtml" Methode is not precise enough.)
CODE:
'====================================================
Public Sub Fp_InsertIncludeWebbot(Url, Optional MyForm As Object)
'---------------------------------------
'Fp_InsertIncludeWebbot Url
'Fp_InsertIncludeWebbot Url, Me '(if Using in a Form)
'---------------------------------------
'Inserts a Fp Webbot like:
'<!--webbot bot="Include" U-Include="MASTER/RightNavbar01.htm" TAG="BODY"
'---------------------------------------
Dim Left, Top
Dim ControlType, ControlId
ControlType = 1
ControlId = 4212 'ID of "Include Page" Command
'----------------------------------------
'Hide MyForm if necessary
If IsMissing(MyForm) Then
Else
Left = MyForm.Left
Top = MyForm.Top
MyForm.Hide '<<<<<<<< Focus is passed to Frontpage-Window
End If
'----------------------------------------
'Insert Include Webbot
SendKeys Url, False
SendKeys "{ENTER}", False
Vba_ExecuteCommandbarControl ControlType, ControlId
'Vba_ExecuteCommandbarControl ControlType, ControlId
DoEvents
'----------------------------------------
'Show MyForm if necessary
If IsMissing(MyForm) Then
Else
MyForm.Show '<<<<<<<< Focus is returned to MyForm
MyForm.Top = Top
MyForm.Left = Left
End If
'----------------------------------------
End Sub
'===================================================
Public Sub Vba_ExecuteCommandbarControl(ControlType, ControlId)
'--------------------------------------------
'Vba_ExecuteCommandbarControl ControlType, ControlId
'--------------------------------------------
'INFO:
'MsgBox Application.CommandBars("Test").Controls(1).Type
'MsgBox Application.CommandBars("Test").Controls(1).Id
'--------------------------------------------
On Error Resume Next
Err = 0
CommandBars(CommandBars.FindControl(ControlType,
ControlId).Parent.Index).FindControl(ControlType, ControlId).Execute
If Err <> 0 Then MsgBox "Error"
'--------------------------------------------
End Sub
'==================================================