Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2019, 10:42 PM
petrimo petrimo is offline COMException 0x800A1492 Windows 10 COMException 0x800A1492 Office 2013
Novice
COMException 0x800A1492
 
Join Date: Feb 2019
Posts: 1
petrimo is on a distinguished road
Default COMException 0x800A1492


I'm getting an exception in my vb.net project:
System.Runtime.InteropServices.COMException (0x800A1492): You cannot paste this selection into a table. at Microsoft.Office.Interop.Word.Range.Paste()

The code is:
Code:
bookmark.Select()
_WordApplication.ActiveDocument.SetCompatibilityMode(Microsoft.Office.Interop.Word.WdCompatibilityMode.wdWord2013)
_WordApplication.Selection.Copy()
_WordApplication.Selection.MoveStart()
_WordApplication.Selection.MoveUp(Unit:=Word.WdUnits.wdLine, Count:=1)
_WordApplication.Selection.Range.Paste()
_WordApplication.Selection.Paste()
Bookmark is a table in word-template. The idea is to read values from SQL-database and insert several rows to table in word-document. I have tried with different versions of Microsoft.Office.Interop.Word.dll with no success.
This code works in older WIN7-environments but not in all WIN10-environments. In some WIN10-environment it works OK.
Any idea what could be wrong?
Reply With Quote
  #2  
Old 02-19-2019, 12:18 AM
macropod's Avatar
macropod macropod is offline COMException 0x800A1492 Windows 7 64bit COMException 0x800A1492 Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The Windows environment is unimportant; what matters is the Word version. If a given PC lacks Word 2013 (cf. your reference to wdWord2013), your code will fail. As it is, your code is especially inefficient, per its repeated use of Selections.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
comexception, range.paste, wordapplication



Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting COMException Incompatible file type and file extension sbalerao Mail Merge 0 04-21-2011 10:30 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:44 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft