Re: VBA - vytvoreni tabulky

From: ov <o.vahalik (zavinac)>
Date: 06. 05. 2005, 17:54 CEST
po zbeznom zhliadnuti sa mi zda ze ti chyba jedna bodka:
tvoje:
With Selection.Tables(1)
spravne
With .Selection.Tables(1)

No dyt:
Ono to selection patri k objektu wd, coz mi nedoslo.

TAkze jsi mi to zachranil a za to Ti moc dekuju.
AHoj
OV


On 5/5/05, ov <o.vahalik@atlas.cz> wrote:
> Ahoj.
> V office2000 VBA mam nasledujici problem:
>
> Pokud vytvorim tabulku ve wordu pomoci kodu
>
> Sub tabulka_ ve_wordu()
> ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=6, NumColumns:=
_
>        2, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
>        wdAutoFitFixed
>    With Selection.Tables(1)
>        .Columns.PreferredWidth = CentimetersToPoints(8.5)
>        .Rows.Height = CentimetersToPoints(3.2)
>    End With
> End Sub
> atd. atd.
> je vse funkcni,  tabulka se vytvori
>
> Potrebuju ale vytvorit tuto tabulku v excelu a kdyz pouziji stejneho kodu,
> skoncim u vytvoreni tabulky
> _______________________________________
> Public wd As Word.Application
> Sub tabulka_z_excelu()
>    Set wd = CreateObject("word.application.9")
>        otevrit
>    Set wd = Nothing
> End Sub
> _____________________________
>
> Sub otevrit()
>
>    With wd
>        .Documents.Add Template:="Normal", NewTemplate:=False,
> DocumentType:=0                ' OK
>        .Visible = True
> ' OK
>        .ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=6,
> NumColumns:= _
>        2, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:=
> wdAutoFitFixed          '  ***
>
>        With Selection.Tables(1)
>            .Columns.PreferredWidth = CentimetersToPoints(8.5)
>            .Rows.Height = CentimetersToPoints(3.2)
>        End With
>   End With
>
> End Sub
> ______________________________
>
> *** Tady mi vyskoci chybove hlaseni:
> " Wrong number of arguments or invalid property assignment"
>
> Netusite nekdo, proc?
>
> Diky.
> OV
AleX
Received on Fri, 6 May 2005 17:54:42 +0200

This archive was generated by hypermail 2.1.8 : 06. 05. 2005, 17:58 CEST