Macro for Paste Special - Picture (Enhanced Metafile)

MS WORD

    Next

  • 1. Find/replace in all areas of document
    As a solution to a problem I'm having with a bar code font, I'm creating a macro to find/replace throughout a document. However, I would like to perform the same find/replace in every area of the document: the main body, headers and footers (current, odd/even, first page), footnotes and endnotes, text boxes, etc. I've sorted out the correct code to run the find/replace I need but I'm looking for a way in VBA to access all of these different areas. Ideas I've had include SeekView and Story but they don't seem to have constants for odd headers/footers (though they curiously have ones for even pages!). Is there a collection - with a corresponding object variable - that can be conveniently used? Or any other methods (I guess I can always use an error handler to cope with documents that don't contain every particular area)? Text boxes seem to be the toughest to write generic code for. My plan is to then run this macro on each of several hundred templates we need to change so I need it to be pretty flexible. Hope you can help!
  • 2. Keeping Documents in Print View
    Hi all, I'm having a problem using VBA to tie together Excel and Word. My code is completely within Excel, and I'd prefer there to be no macros inside the Word docs (this is rather easy to solve if you can do that). Basically, my problem is as follows: what I'm doing is using VBA to open two different documents, make modifications to both of them, and then save multiple copies of both. The code to open the documents looks sort of like this (where objWord is my Word.Application object): If writeDocA Then objWord.Documents.Open (docAFilename) Set docA = objWord.Documents(docAFilename) End If If writeDocB Then objWord.Documents.Open (docBFilename) Set docB = objWord.Documents(docBFilename) End If Both documents are in print view the entire time, including when they're being modified (it takes long enough that I can look at them as the macro runs). However, once I look at the saved files, whichever one was opened first (so, in the above case, docA, but I can switch them and it'll happen to docB) opens in normal view. The other one still opens in print view. I'm assuming this error has something to do with which document is "active," for some definition of active, but I couldn't get anything to work. Any ideas? Thanks, Mike
  • 3. I am losing data on a form that I created in word
    I have created a template with form fields. If I protect/unprotect the documents created from the template, I am losing data. Can anyone advise? TIA! jennifer
  • 4. Insert a box defaulted to "Checked"
    I'm trying to create two buttons for a toolbar one that inserts a Forms check unchecked and one that defaults to checked. The first I can record with macro, but I'm at a loss when it comes to what to put for "With Selection", obviously this didn't work: Sub BoxChked() Selection.FormFields.Add Range:=Selection.Range, Type:=wdFieldFormCheckBox With Selection.DefaultValue .Checked = True End With End Sub ~Lori

Macro for Paste Special - Picture (Enhanced Metafile)

Postby T3JpYW5h » Sun, 20 Sep 2009 03:04:01 GMT

Hello!  I am trying to set up a macro (key command alt+ctrl+p) that will 
perform the following command: Paste Special - Picture (Enhanced Metafile).  
I tried recording a macro to do this, and it came up with this:

Sub PasteMetafile()
'
' PasteMetafile Macro
'
'
   Application.Run MacroName:="Normal.Module2.EditPasteSpecial
End Sub

When I try to run it, it takes me to the "Paste Special" screen that pops 
up, but it doesn't select Picture (Enhanced Metafile) for me.  I found this 
code from someone else:

AppWord.Selection.PasteSpecial Placement:=wdInLine, 
DataType:=wdPasteMetafilePicture

...but it gives me Error 424 "Object required."

How can I make it specifically choose Picture (Enhanced Metafile)?

Just FYI, I have another macro set up already that tells Word whenever I use 
Paste Special to paste everything as inline rather than floating.

Thank you!

RE: Macro for Paste Special - Picture (Enhanced Metafile)

Postby T3JpYW5h » Sun, 20 Sep 2009 03:10:01 GMT

Actually, I sort've got it to work!  I used:

Selection.PasteSpecial Placement:=wdInLine, 
DataType:=wdPasteMetafilePicture

BUT - now here's what's happening.

I have graphs in Excel I am copying and pasting as Pictures (Enhanced 
Metafiles) into Word (no linking involved).  I have to go through and replace 
a bunch of the pictures.  When I use this paste special command manually, it 
keeps the same formatting as the picture it is "replacing."  Now, when I use 
this macro, it changes the size of the picture.  Can I code the macro to 
somehow keep the same formatting as the object it's replacing?





Similar Threads:

1.Paste Special , Paste link as Picture (enhanced metafile)

Hallo,

One of my colleague wants to paste excel table  in word.

He select the cell and use paste special in Word , paste link and would like 
to  paste as Picture(Enhanced Metafile).

But Picture(Enhanced Metafile option is missing in word.  He only gets 
Graphic (windows metafile)

We are using Office 2003. He told this option was avalaible in Office XP 2002.

Any idea, how to get this option in Word 2003?


Regards,
Atul

2.Paste Special: Metafile vs Enhanced Metafile

What's the difference between Picture (Windows Metafile) and Picture 
(Enhanced Metafile) in the Paste Special options? Is there a good rule as to 
when to use one over the other?

At a quick look for pasting Excel sheets, they seem the same, but I'd guess 
that's just because Excel sheets don't have any fancy graphics, gradients, 
etc. But that's just my guess. Perhaps Windows Metafile is fine for basic 
shapes and Enhanced Metafile is better for advanced vector images?

Thanks,
Colin 


3.Paste Special, picture (enhanced metafile) Problem in Word 2003

Is there anything I can do to control the font & point size of my paste 
special text?

Each time I select, copy & paste special, picture (enhanced metafile), the 
font/point sizes change.  The source is a combination of text and images.  I 
want to paste them into another file as a single image.  But when I do, the 
text changes point sizes.

I have tried changing the source font point size in anticipation, but Word 
seems to ignore my settings.

Roy

4.Paste Special Enhanced Metafile

Just a quick query that is proving to be infuriating. 

I have a pdf file that I need to copy in excess of 40 seperate charts/tables 
out of and paste into Word/Powerpoint. From the pdf I am picking up the area 
that is needed to be copied using the snapshot tool and then pasting as an 
enhanced metafile into Word or Powerpoint.

However, colleagues have no problem with this process but there is some real 
inconsistency on the availability of the enhanced metafile paste option when 
I do it. For instance, I can snapshot the same graphic three times and on the 
third attempt to paste as an enhanced metafile it works, but on the two 
previous attempts I'm not presented with this option.

Is there a reason for this inconsistency and can I amend this somehow?

Many Thanks

5.Pasting Excel cells as "Picture (Enhanced Metafile)"

Hello

I need to paste cells from Excel into Word  as "Picture (Enhanced Metafile)" 
(I need to do this over 100 times).  Every time I do this, the resulting 
picture's top left corner ends up violating the top left margin of the Word 
document (even though my cursor was located at the top left corner of the 
page when I did the pasting).  I then have to both move and resize this 
picture.  Is there any way to either

a)  automatically resize the picture so it has the largest possible size 
without violating any of the page margins (and not being distorted)

OR

b)  if (a) above is not possible, at least move the picture so that its top 
left corner is at the top left corner (as defined by the margins set for the 
page) of the page?

Thank you for your help! 

6. Editing a Table Pasted from Excel into Word as a Picture (Enhanced Metafile)

7. Pasting Excel Graphs (charts/enhanced metafile pictures) into Word

8. Macro to paste chart as enhanced metafile



Return to MS WORD

 

Who is online

Users browsing this forum: No registered users and 26 guest