Ho cercato di tradurre il seguente codice VBA in VBNet, ma ottengo un errore che non riesco a risolvere.
In VBA con questo codice seleziono e taglio il contenuto di una tabella in Word.
codice:
Dim Mycells(1) As Range
With Doc
Mycells(0) = .Range(Start:=.Tables(1).Cell(4, 3).Range.Start, End:=.Tables(1).Cell(13, 3).Range.End)
Mycells(0).Select()
Selection.Cut()
End with
In VbNet, dopo aver importato Microsoft.Office.Interop.Word, lo stesso codice (cambia solo la prima riga) mi restituisce il seguente errore: “Selection non dichiarato, impossibile accedere a causa del livello di protezione.”
Come faccio a dichiarare Selection ?
codice:
Dim Mycells(1) As word.Range
With Doc
Mycells(0) = .Range(Start:=.Tables(1).Cell(4, 3).Range.Start, End:=.Tables(1).Cell(13, 3).Range.End)
Mycells(0).Select()
Selection.Cut()
End with
grazie ciao