Update Bookmark filed in msWord stopped warking.

Offer Dahan 0 Reputation points
2023-01-19T15:51:20.6933333+00:00

Update - as I thought, problem had nothing to do with the code.cant find how to delete the question

I wrote code to insert data to Word document using vb.net.
I work with it already few years and all is fine.
I changed computer, moved to windows 11 and it stopped working But!! very importants issue, on another computer, same brand, same windows, still working.

I belive the problem is not in the code but in the Word or windows security.
if someone expirience it before, any help will do.

This is the code:

    wordQuoteApp.Selection.GoTo(What:=Word.WdGoToItem.wdGoToBookmark, Name:="mTrvaly")
            wordQuoteApp.Selection.TypeText(Text:= .Address)
    

this is the Error:
System.Runtime.InteropServices.COMException: 'The Insert statement is currently disabled.'

and detailed:

System.Runtime.InteropServices.COMException
  HResult=0x800A1221
  Message=The Insert statement is currently disabled.
  Source=Chatuna
  StackTrace:
   at Microsoft.Office.Interop.Word.Selection.TypeText(String Text)
   at Chatuna.frmMain.FillInfo(Boolean Empty) in C:\Users\offer\OneDrive\VB. Backup\Chatuna\Chatuna - 04_12_22 - new Email\frmMain.vb:line 90
   at Chatuna.frmMain.btnInfo_Click(Object sender, EventArgs e) in C:\Users\offer\OneDrive\VB. Backup\Chatuna\Chatuna - 04_12_22 - new Email\frmMain.vb:line 58
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
   at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
   at Chatuna.My.MyApplication.Main(String[] Args) in :line 83

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
1,977 questions
{count} votes