I'm using this code:
With oWordApp.Selection.Find
.Text = "<CurrentDate>"
With .Replacement
.Text = System.DateTime.Now.ToShortDateString()
End With
.Execute(Replace:=Word.WdReplace.wdReplaceAll)
End With
but get an error message of:
System.NullReferenceException: Object variable or With block variable not set.
at Microsoft.VisualBasic.CompilerServices.Symbols.Container..ctor(Object Instance)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at B3WebService.Service1.B3DocumentSvc1(String DocumentName, WS_Quote Quote, WS_RentalStream PaymentHeader, WS_RentalStreamRecord[] Payments, Entity Customer) in D:\Code\WebService\Dev\App_Code\Service1.asmx.vb:line 248
any ideas why? the error line is the execute.
With oWordApp.Selection.Find
.Text = "<CurrentDate>"
With .Replacement
.Text = System.DateTime.Now.ToShortDateString()
End With
.Execute(Replace:=Word.WdReplace.wdReplaceAll)
End With
but get an error message of:
System.NullReferenceException: Object variable or With block variable not set.
at Microsoft.VisualBasic.CompilerServices.Symbols.Container..ctor(Object Instance)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at B3WebService.Service1.B3DocumentSvc1(String DocumentName, WS_Quote Quote, WS_RentalStream PaymentHeader, WS_RentalStreamRecord[] Payments, Entity Customer) in D:\Code\WebService\Dev\App_Code\Service1.asmx.vb:line 248
any ideas why? the error line is the execute.