![]() |
|
#1
|
||||
|
||||
![]()
The table count can be obtained with:
ActiveDocument.Tables.Count A loop in VBA might be constructed with code like: Code:
Sub Demo1() Dim i As along With ActiveDocument For i = 1 To .Tables.Count 'process the table With .Tables(i) 'table processing code goes here End With 'or, perhaps: .Tables(i).Range.Copy Next End With End Sub Code:
Sub Demo2() Dim Tbl As Table For Each Tbl In ActiveDocument.Tables 'process the table With Tbl 'table processing code goes here End With 'or, perhaps: Tbl.Range.Copy Next End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
|||
|
|||
![]()
Thanks Macropod!
I updated my code as following, but this does not work. I hightlighted the part I updated per your comments. Is this correct? filename script "C:\Users\zzz\Desktop\New\wdtb2ppt.vbs"; data _null_; file script; put 'Set objWord = CreateObject("Word.Application")'; put 'objWord.Visible = False'; /* Slide 1*/ put 'Set objDoc = objWord.Documents.Open("' "C:\Users\zzz\Desktop\New\t_aesum_age_saf.rtf"'")' ; put 'Set objSelection = objWord.Selection'; put 'Set objPPT = CreateObject("PowerPoint.Application")'; put 'objPPT.Visible = True'; put 'Set objPresentation = objPPT.Presentations.Add'; /* put 'objPresentation.ApplyTemplate("C:\temp\tmp3.pot") ';*/ put 'Sub Demo2()'; put 'Dim Tbl As Table'; put 'For Each Tbl In ActiveDocument.Tables'; put 'objDoc.Activate'; put 'With Tbl'; put 'objDoc.Tbl.Range.Select'; put 'End With'; put 'Tbl.Range.Copy'; put 'Set objSlide = objPresentation.Slides.Add(1,12)'; put 'objPPT.ActiveWindow.View.Paste'; put 'Next'; put 'End Sub'; put 'objPresentation.SaveAs("C:\Users\zzz\Desktop\New\ table.ppt")'; put 'objPresentation.Close'; put 'objPPT.Quit'; put 'objDoc.Close'; put 'objWord.Quit'; run; filename xx pipe "cscript //nologo ""C:\Users\zzz\Desktop\New\wdtb2ppt.vbs"""; data _null_; infile xx; input; put _infile_; run; |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
tcoggins | Word Tables | 2 | 06-29-2016 10:28 AM |
![]() |
kamal.shah | Word Tables | 2 | 01-26-2015 03:47 AM |
convert tables to fillable forms in word | expert4knowledge | Word | 1 | 02-13-2014 03:06 AM |
![]() |
fig000 | Word | 1 | 11-17-2013 01:46 AM |
Convert a file from HTML to WORD format weblayout view | gtselvam | Word | 0 | 12-02-2008 03:53 AM |