0
VBAモジュールでREST Webサービスを呼び出して、Word文書にブックマークを設定しようとしています。いくつかの理由コードは、実際には、ブックマークリストで完全に表示されているとき、あなたはここにVBA関数がブックマークを見つけることができません。
を見るようにブックマーク「CCAP1」は、ドキュメント内に存在していないことを言って、このライン
Set cCap1 = ActiveDocument.Bookmarks("CCAP1").Range
cCap1.Text = keyResult.SelectSingleNode("//cCap").Text
でフリーズ
私はWebサービスをチェックし、問題を起こさない有効なXMLドキュメントを返します。
あなたは
Public Static Sub callRestService()
Dim idC As String
Dim custDate As String
Dim query As String
idC = mdlFormVal.getIdC
custDate = mdlFormVal.getCustDate
query = "http://path/to/webservice/service?key=" + idC
Dim keyResult As New MSXML2.DOMDocument60
Dim keyService As New MSXML2.XMLHTTP60
keyService.Open "GET", query, False
keyService.send
keyResult.LoadXML (keyService.responseText)
Dim cRas As Range
Dim cRas1 As Range
Dim cRas2 As Range
Dim cRas3 As Range
Dim cRas4 As Range
Dim cCap As Range
Dim cCap1 As Range
Dim cCap2 As Range
Dim cCf As Range
Dim cCf1 As Range
Dim cInd As Range
Dim cInd1 As Range
Dim cInd2 As Range
Dim cLoc As Range
Dim cLoc1 As Range
Dim cLoc2 As Range
Dim cPIva As Range
Dim cPIva1 As Range
Dim cPrvn As Range
Dim cPrvn1 As Range
Dim cPrvn2 As Range
Dim cusDate As Range
Set cRas = ActiveDocument.Bookmarks("CRAS").Range
cRas.Text = keyResult.SelectSingleNode("//cRas").Text
Set cRas1 = ActiveDocument.Bookmarks("CRAS1").Range
cRas1.Text = keyResult.SelectSingleNode("//cRas").Text
Set cRas2 = ActiveDocument.Bookmarks("CRAS2").Range
cRas2.Text = keyResult.SelectSingleNode("//cRas").Text
Set cRas3 = ActiveDocument.Bookmarks("CRAS3").Range
cRas3.Text = keyResult.SelectSingleNode("//cRas").Text
Set cRas4 = ActiveDocument.Bookmarks("CRAS4").Range
cRas4.Text = keyResult.SelectSingleNode("//cRas").Text
Set cCap = ActiveDocument.Bookmarks("CCAP").Range
cCap.Text = keyResult.SelectSingleNode("//cCap").Text
Set cCap1 = ActiveDocument.Bookmarks("CCAP1").Range
cCap1.Text = keyResult.SelectSingleNode("//cCap").Text
Set cCap2 = ActiveDocument.Bookmarks("CCAP2").Range
cCap2.Text = keyResult.SelectSingleNode("//cCap").Text
Set cCf = ActiveDocument.Bookmarks("CCF").Range
cCf.Text = keyResult.SelectSingleNode("//cCf").Text
Set cCf1 = ActiveDocument.Bookmarks("CCF1").Range
cCf1.Text = keyResult.SelectSingleNode("//cCf").Text
Set cInd = ActiveDocument.Bookmarks("CIND").Range
cInd.Text = keyResult.SelectSingleNode("//cInd").Text
Set cInd1 = ActiveDocument.Bookmarks("CIND1").Range
cInd1.Text = keyResult.SelectSingleNode("//cInd").Text
Set cInd2 = ActiveDocument.Bookmarks("CIND2").Range
cInd2.Text = keyResult.SelectSingleNode("//cInd").Text
Set cLoc = ActiveDocument.Bookmarks("CLOC").Range
cLoc.Text = keyResult.SelectSingleNode("//cLoc").Text
Set cLoc1 = ActiveDocument.Bookmarks("CLOC1").Range
cLoc1.Text = keyResult.SelectSingleNode("//cLoc").Text
Set cLoc2 = ActiveDocument.Bookmarks("CLOC2").Range
cLoc2.Text = keyResult.SelectSingleNode("//cLoc").Text
Set cPIva = ActiveDocument.Bookmarks("CPIVA").Range
cPIva.Text = keyResult.SelectSingleNode("//cPIva").Text
Set cPIva1 = ActiveDocument.Bookmarks("CPIVA1").Range
cPIva1.Text = keyResult.SelectSingleNode("//cPIva").Text
Set cPrvn = ActiveDocument.Bookmarks("CPRVN").Range
cPrvn.Text = keyResult.SelectSingleNode("//cPrvn").Text
Set cPrvn1 = ActiveDocument.Bookmarks("CPRVN1").Range
cPrvn1.Text = keyResult.SelectSingleNode("//cPrvn").Text
Set cPrvn2 = ActiveDocument.Bookmarks("CPRVN2").Range
cPrvn2.Text = keyResult.SelectSingleNode("cPrvn").Text
Set cusDate = ActiveDocument.Bookmarks("CUSTDATE").Range
cusDate.Text = custDate
End Sub
は誰もが今までこのような何かに遭遇した完全なVBAモジュールのコードを見つけるに続き? ありがとうございます。