Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2005

Tip: Looking for answers? Try searching our database.

Paste Excel data as picture

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andy - 13 Sep 2005 15:40 GMT
Hi All

I am trying to write a Word macro that will copy data from Excel and paste
it into a word document as a picture.  Generally, if I don't know how to do
something in code I just record a similar macro and modify the code as
appropriate.  However, this approach seems to have failed in this instance.  
On record a macro to do this, Word creates the line:

Selection.PasteAndFormat (wdPasteDefault)

In recording the macro it works fine.  However, when I insert this into my
code and run it, the Excel data is copied into a Word table.  On the
offchance I have tried using the wdChartPicture constanct but that didn't
work (presumably because its not a chart!) and also used PasteSpecial instead
of PasteAndFormat but all to no avail.  Does anybody know how to do this?

Thanks

Andy
Helmut Weber - 13 Sep 2005 19:47 GMT
Hi Andy,

it is always kind of wierd with dialogs,
and I don't understand it all,
nevertheless, this one seems to work:

Sub Macro2()
Dim oDlg As Dialog
Set oDlg = Dialogs(wdDialogEditPasteSpecial)
With oDlg
  .Update
  .datatype = "Bitmap"
  .Execute
End With
End Sub

You may test what other datatypes there are, like:

Sub Macro2()
Dim oDlg As Dialog
Set oDlg = Dialogs(wdDialogEditPasteSpecial)
With oDlg
  .Update
  .datatype = "Bitmap"
  .Display
  MsgBox .datatype
  .Update
  .Display ' choose another type
  MsgBox .datatype
  .Update
  .Display ' choose another type
  MsgBox .datatype
End With
End Sub

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"

Andy - 14 Sep 2005 10:57 GMT
Hi Helmut

Thanks for this - it works perfectly!

On a completely irrelevent point - I've visited Friesenried in Bavaria and
think its a beautiful part of the world - I hope you enjoy living there!

Thanks

Andy

> Hi Andy,
>
[quoted text clipped - 30 lines]
> End With
> End Sub
Naz - 30 Oct 2005 01:32 GMT
I used this code today - Many thanks

Signature

_______________________
Naz,
London

> Hi Andy,
>
[quoted text clipped - 30 lines]
> End With
> End Sub

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.