![]() |
#5
|
|||
|
|||
![]() Code:
Private Sub CopyToWord() Dim arr As Variant arr = Array("A", "B", "C") With ActiveSheet .Cells.Clear For x = 1 To 3 .Range(arr(x - 1) & "1").Value = x Next x .Range("A1:C1").Copy End With Dim AppWord As Word.Application Set AppWord = CreateObject("Word.Application") With AppWord .Visible = True .Documents.Add .Selection.Paste End With ''''''''''''''''''''''''''' With AppWord.ActiveDocument.Tables(0) .Delete End With ''''''''''''''''''''''''''' Set AppWord = Nothing End Sub Reported "Application defined or object defined error" I remember I've learnt to set variable for the table But here I don't know how to select the table in Word from Excel VBA And I want to select the table as the .Paste command auto copy the Excel data to Word in a table format I want to do something to the table like deleting it, adding borders or some styles to it So I want to ask how I can control the word table from Excel VBA Many thanks. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Simple VBA macro error | Formulayeti | PowerPoint | 1 | 12-09-2011 10:02 PM |
![]() |
Frankwlc | Word | 5 | 11-28-2011 01:54 AM |
![]() |
Janette | Word | 1 | 11-12-2011 08:23 AM |
Macro Error 5174 | muster36 | Word VBA | 0 | 08-12-2011 03:34 AM |
Converting from Works | Menno Hershberger | Office | 0 | 09-01-2010 11:33 PM |