2014-09-04 47 views
0
Sub inserttable() 

Dim wdapp 
Dim wddoc 
Dim strdocname 
Set wdapp = CreateObject("word.application") 
wdapp.Visible = True 
Set wddoc = wdapp.Documents.Open("C:\Documents and Settings\dssuser.GGNS1DSS22\Desktop\sahil3.doc") 
table = wddoc.table.Count 
If table = 0 Then 
    MsgBox ("no table found") 
Else 
    MsgBox ("table found") 
    Exit Sub 
End If 
wddoc.Close 
wdapp.Quit 

Set wddoc = Nothing 
Set wdapp = Nothing 

End Sub 
+2

請提供您的問題的解釋!也請看看這個:http://stackoverflow.com/help/dont-ask和這個:http://stackoverflow.com/help/how-to-ask – DatRid 2014-09-04 07:42:27

回答

0

你太親近了!如果你沒有一個錯字在你的代碼,那麼這是它(,不):

table = wddoc.tables.Count