Jump to content
Macro Express Forums

Clipboard contents to variable (with format etc.)


Recommended Posts

Hey everyone, 

 

is there a way to save clipboard information to a variable, which can be later (through the variable) pasted without losing formats/attributes? 

 

Example:  I copy a table in word, save the clipboard contents as string variable. Later I paste the content of the string variable but it only pastes the text without the table or any kind of format.

 

So is there a variable type that can store all the information the clipboard has and not just the plain text?

If not, is there a workaround? Thanks in advance.

Link to comment
Share on other sites

MEP variable is plain text only. When one gets data from the Windows Clipboard there are several methods, text, image, binary. I'm sure MEP is using the text method.

You could possibly use an application like WordPad to save files of your clips. But that sounds cumbersome.

I recommend you use a clipboard application which can handle multiple clips. A coon's age ago I used one called ClipMate. I don't know if it's still around. But if it were me I'd use an application like that and command MEP with it. Or, it might be that you don't even need MEP with an application like that. 

Link to comment
Share on other sites

I believe Clipmate is still "alive" though it hasn't been updated in years.  

 

If you're copying from Word, then back in to Word, VBA might be the way to go.  And/or, Words native Quickparts feature...

Link to comment
Share on other sites

If you are wanting to capture formatted text from a Word document, and if the entire text is the same formatting, there may be a way:

 

1. Select the text in Word.

2. Copy its formatting. By default, the hotkey is Ctrl+Shift+c

3. Copy the text to the clipboard.

4. Use Macro Express to copy the clipboard to a text variable.

5. Use Macro Express to manipulate the text variable.

6. Output the text variable back into a Word document.

7. Select it.

8. Paste the previously copied formatting, which by default is Ctrl+Shift+v

Link to comment
Share on other sites

On 7/11/2019 at 5:31 PM, kunkel321 said:

I believe Clipmate is still "alive" though it hasn't been updated in years.  

 

If you're copying from Word, then back in to Word, VBA might be the way to go.  And/or, Words native Quickparts feature...

I use Clipmate with macros, but find that format handling in Macro Express is not great.


Even internal management of clips in Macro Express leaves something to be desired.  Remove line breaks and carriage returns and you also remove spaces. So it all runs on.


And passing keystrokes from Macro Express to Clipmate is not without issues.


But my Macro Express programming skills are rudimentary.

Link to comment
Share on other sites

This got me thinking about something I saw in a Windows Insider announcement a long time ago. A few month's back Windows Clipboard got an option for history.  But instead of CTRL+v you use Win+v, it will show you your clipboard history. Just go into your Windows System Settings > System > Clipboard and enable it.

Link to comment
Share on other sites

  • 3 weeks later...

Hi Cory,

 

I have Win 10 1803 build 17134.885 which doesn't have a Clipboard section in Settings > System. I assume it's in 1903.

 

Settings > Update & Security > Windows Update tells me I am up-to-date but also, in contradiction, says 1903 is ready for me to install when I'm ready. I recall reading about several serious issues with it so I'm not over-enthusiastic. What's the consensus?

Link to comment
Share on other sites

Hi Terry. As I'm in the UK too, I'm surprise you don't have 1903 yet as I got upgraded on 3rd July. I think you need to manually invoke 'Check for updates' in order to update it. I haven't noticed any obvious issues so far since updating*.

 

* Don't blame if if you do 🙂

 

Alan

Link to comment
Share on other sites

Thanks Alan. (And I hope Kirkcaldy always will be!)

 

I decided last night to bite the bullet and 1903 build 18362.267  is now installed. Some minor things awaiting resolution but generally looks OK so far.

 

But disappointingly it hasn't miraculously resolved a couple of MEP issues (or a couple of others) as I'd tentatively hoped.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...