我一直負責到Access升級從2003年到2007年的DB的目的是創建一個自動從生成數據的Power Point演示Excel電子表格。我能夠導入數據,但是當試圖將其生成到電源點時,我收到一個錯誤。看起來像是在嘗試從Excel電子表格中獲取數據並將其放入Powerpoint演示文稿的表格中時發生錯誤。此代碼由其他人完成,我不確定這兩個版本之間有什麼不同。請幫忙!以下全部是代碼的一部分..不太確定爲什麼它將它的方式分開..接受。讓我知道如果你需要更多的信息。看到錯誤代碼和下面:
錯誤:運行時錯誤-2147467259(800004005) Method對象「形狀」的「表」失敗
'Replace all tags with values from datarow
With shape.Table
.Cell(1, 1).shape.TextFrame.TextRange.Text = Replace(.Cell(1, 1).shape.TextFrame.TextRange.Text, "<ID>", ID)
.Cell(1, 3).shape.TextFrame.TextRange.Text = Replace(.Cell(1, 3).shape.TextFrame.TextRange.Text, "<TITLE>", TITLE)
.Cell(2, 1).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 1).shape.TextFrame.TextRange.Text, "<STATUS>", status)
.Cell(2, 1).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 1).shape.TextFrame.TextRange.Text, "<OWNER>", OWNER)
' is part of WBS in cost changes (Perry Sedlar)
.Cell(2, 1).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 1).shape.TextFrame.TextRange.Text, "<REP>", REP)
.Cell(2, 1).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 1).shape.TextFrame.TextRange.Text, "<ACTION>", ACTION)
' Shifted to the left after removing Gov't Rep column (Perry Sedlar)
.Cell(2, 3).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 3).shape.TextFrame.TextRange.Text, "<MCE>", MCE)
.Cell(2, 3).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 3).shape.TextFrame.TextRange.Text, "<ISSUE>", ISSUE)
' is part of WBS in cost changes (Perry Sedlar)
.Cell(2, 3).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 3).shape.TextFrame.TextRange.Text, "<ACTION>", ACTION)
' Shifted to the left after removing Gov't Rep column (Perry Sedlar)
.Cell(2, 3).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 3).shape.TextFrame.TextRange.Text, "<PM>", PM)0
' Shifted to the left after removing Gov't Rep column (Perry Sedlar)
.Cell(2, 5).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 5).shape.TextFrame.TextRange.Text, "<HA>", HA)
.Cell(2, 5).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 5).shape.TextFrame.TextRange.Text, "<MP>", MP)
' is part of WBS in cost changes (Perry Sedlar)
.Cell(2, 5).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 5).shape.TextFrame.TextRange.Text, "<PM>", PM)
' Shifted to the left after removing Gov't Rep column (Perry Sedlar)
.Cell(2, 5).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 5).shape.TextFrame.TextRange.Text, "<LVL>", LVL)
' Shifted to the left after removing Gov't Rep column (Perry Sedlar)
.Cell(2, 8).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 8).shape.TextFrame.TextRange.Text, "<PROB>", Prob)
.Cell(2, 8).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 8).shape.TextFrame.TextRange.Text, "<EXP>", EXP)
' is part of WBS in cost changes (Perry Sedlar)
.Cell(2, 8).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 8).shape.TextFrame.TextRange.Text, "<LVL>", LVL)
.Cell(3, 1).shape.TextFrame.TextRange.Text = Replace(.Cell(3, 1).shape.TextFrame.TextRange.Text, "<DESCRIPTION>", DESC)
.Cell(4, 10).shape.TextFrame.TextRange.Text = Replace(.Cell(4, 10).shape.TextFrame.TextRange.Text, "<C>", C)
.Cell(4, 10).shape.TextFrame.TextRange.Text = Replace(.Cell(4, 10).shape.TextFrame.TextRange.Text, "<S>", S)
.Cell(4, 10).shape.TextFrame.TextRange.Text = Replace(.Cell(4, 10).shape.TextFrame.TextRange.Text, "<T>", T)
.Cell(4, 10).shape.TextFrame.TextRange.Text = Replace(.Cell(4, 10).shape.TextFrame.TextRange.Text, "<O>", o)
.Cell(2, 8).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 8).shape.TextFrame.TextRange.Text, "<ARO>", Trend_Arrow)
If IssueFileRead = "N" Then ' Check to see if running Issue or Risk.. templates are now different (Perry Sedlar)
' This code is for Risk Slides (Perry Sedlar)
.Cell(2, 1).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 1).shape.TextFrame.TextRange.Text, "<OCCUR>", OCCUR)
.Cell(2, 1).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 1).shape.TextFrame.TextRange.Text, "<OCCUR_FACT>", OCCUR_FACT)
.Cell(2, 3).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 3).shape.TextFrame.TextRange.Text, "<MIT>", MIT)
.Cell(2, 3).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 3).shape.TextFrame.TextRange.Text, "<MIT_FACT>", MIT_FACT)
.Cell(2, 5).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 5).shape.TextFrame.TextRange.Text, "<OPP>", OPP)
.Cell(2, 5).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 5).shape.TextFrame.TextRange.Text, "<OPP_FACT>", OPP_FACT)
.Cell(2, 7).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 7).shape.TextFrame.TextRange.Text, "<IPT>", IPT)
.Cell(2, 7).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 7).shape.TextFrame.TextRange.Text, "<WBS>", WBS)
Else
' This code if for Issue Slides (Perry Sedlar)
.Cell(2, 1).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 1).shape.TextFrame.TextRange.Text, "<REP>", REP)
.Cell(2, 3).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 3).shape.TextFrame.TextRange.Text, "<ACTION>", ACTION) ' Shifted to the left after removing Gov't Rep column (Perry Sedlar)
.Cell(2, 5).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 5).shape.TextFrame.TextRange.Text, "<PM>", PM) ' Shifted to the left after removing Gov't Rep column (Perry Sedlar)
.Cell(2, 8).shape.TextFrame.TextRange.Text = Replace(.Cell(2, 8).shape.TextFrame.TextRange.Text, "<LVL>", LVL)
End If
End With
End Sub
對不起,我只是回來與你。上週我整個星期都在接受訓練。有沒有一種方法可以將所有代碼放入代碼中,而不會讓代碼太長而無法使用評論框? – user2324835 2013-05-06 12:45:48
此外,我試過你的代碼,它說oSh.HasTable,我收到一個編譯錯誤:找不到方法或數據成員 – user2324835 2013-05-06 15:05:22