Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-12-2023, 07:01 PM
Guessed's Avatar
Guessed Guessed is offline Possibility to copy and paste plain texts with image? Windows 10 Possibility to copy and paste plain texts with image? Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I've updated the code to attempt to deal with your later requirements. These are each dodgy in their own special way and won't give perfect results in most documents but at least most of the drama will be avoided. In the case of your sample doc, you will be able to spot the shortcomings but it gets pretty close to what you probably wanted.



The replacement of section breaks with hard page breaks is a kludge fix that happens to work on your sample doc but will give non-ideal results on better formatted documents.

The graphic conversion to inline shapes failed on a shape in your sample doc so I just put an error skip on that - rather than work out 'why' it failed.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #2  
Old 01-12-2023, 07:51 PM
puff puff is offline Possibility to copy and paste plain texts with image? Windows 10 Possibility to copy and paste plain texts with image? Office 2016
Advanced Beginner
Possibility to copy and paste plain texts with image?
 
Join Date: Apr 2017
Posts: 60
puff is on a distinguished road
Default

Thanks a lot! I didn't even know the existence of ConvertNumbersToText function. It's really handy.

I was writing my own code as well and approached the inline wrapping a bit differently by iterating through all the shapes and do shape.WrapFormat.Type = wdWrapInline after the pasting. I used your code to process another document and notice that some images are still anchored. I can fix this by using my code on the output doc. Don't really know why. I also tried to put InputDoc.Shapes(i).WrapFormat.Type = wdWrapInline after your InputDoc.Shapes(i).ConvertToInlineShape but that didn't help.

Graphic conversion failed on 1 probably because that 1 shape is a textbox. I was processing another document several hours ago and run into this situation, which is really hard to spot on.

I do notice that your code will put the inlineshape at the beginning of the texts, which in the original file are visually above the image. I'll try to iterate through the paragraphs after the pasting and move that image to be after the texts. Anyway, it's really close to what I want to do and I will keep working on this and ask later.
Reply With Quote
Reply

Tags
copy and paste, image insert, template document styles

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Between Two Headings/Texts Noob_VBA Word VBA 14 12-01-2021 12:28 PM
copy paste webp image from internet to word fails to appear DBenz Word 4 05-20-2020 06:49 PM
Need to copy texts from excel and paste in to the Notepad++ in between the particular tags ganesang Word VBA 2 08-27-2018 02:05 AM
Possibility to copy and paste plain texts with image? Keyboard shortcut to paste as plain unformatted text. Wyck Word 1 09-21-2016 03:49 PM
OneNote - Copy and paste image to the table MartinK OneNote 0 09-03-2013 05:08 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:49 PM.


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