this code from hans, but not stable work..
the code use for export data/tabel from excel to ms word
sometime work sometimes not work
here code
Code: Select all
Sub CopyPNG()
Dim oldselect As Range
Dim rng As Range
Set oldselect = Selection
Set wkbCrntWorkBook = ActiveWorkbook
Set rng = Application.InputBox(Prompt:="Select a range to copy", Type:=8)
rng.Select
Selection.CopyPicture xlScreen, xlPicture
rng.Offset(0, rng.Columns.Count).PasteSpecial
Selection.Copy ' Here's the trick bit; we just copy the picture we have just pasted, and bingo ...
' ' ... the image is now available as a PNG on the clipboard; multiple other formnat are also available
Selection.Delete
oldselect.Select
Dim myword As Object
Set myword = CreateObject("word.document")
myword.Application.Visible = True
myword.Application.Selection.PasteSpecial DataType:=15 ' datatype 15 is PNG
End Sub
after run macro show message "Run Time error- "PasteSpecial method of Range class failed"
my workbook contains macro but not protected only to open workbook. The code is protected
if my workbook contains macro and save as in xlsm, the code not work.
my workbook maybe hidden column/rows..and maybe contains merge column/rows..
i hope someone help me out this case
note:
for reason i can't attachted file
.susant