Delete Table with Frontpage VBA
=======================
MY QUESTION WAS:
Wenn der Focus auf einer beliebigen Stellen der Tabele liegt möchte ich mit
Fp VBA Code:
1. die gesamte Tabelle aktivieren
2. die Tabele löschen>
Was ist der Fp VBA Code hierfür?
FOUND SOLUTION:
Solution was found in the CommandBars.Execute Methode and the SendKeys
Funktion
I dont like the Sendkeys funktion very much in this circumstance.
If anyone has a better solution, please tell.
Alexander
CODE:
'=================================================
Public Sub Fp_DeleteTable(Optional MyForm As Object)
'-------------------------------
'Deletes the Frontpage Table which contains the Selection
'Fp_DeleteTable
'Fp_DeleteTable Me '(If you use this Procedure in a Form)
'-------------------------------
'tested for Frontpage 2000
'-------------------------------
On Error Resume Next
Dim rng As IHTMLTxtRange
Dim Top, Left
Dim ControlType, ControlId
ControlType = 1
ControlId = 803 '(Id of the "Select Whole Table" 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
'------------------------------
'Select whole Table
CommandBars(CommandBars.FindControl(ControlType,
ControlId).Parent.Index).FindControl(ControlType, ControlId).Execute
If Err <> 0 Then Err = 0
'------------------------------
'Delet Table
SendKeys "{DEL}", False
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
'=================================================