Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Pasting pictures from Excel to Word (2000)

Robin,

Are you doing this from Excel or from Word?
How are you opening the "other" application?

What I am getting at is... Are you sure you know
what "Selection" is referring to?

Jim Cone
San Francisco, USA


"Robin" wrote in message
...
I am trying to copy from Excel 2000 as a picture and then paste into Word
2000 as a picture. My code will select the contiguous range, but when it
gets to this command:

Selection.CopyPicture Appearance:=xlScreen, Size:=xlScreen,
Format:=xlPicture

I get a run-time error 1004: Application-Defined or Object-Defined Error. I
haven't been able to determine which object is causing this error.

I tried earlier to simply copy the selection in Excel and PasteSpecial into
Word, but nothing seems to get pasted, even thought the code opens the
correct document. When the code finishes, I can manually paste the clipboard
contents, so I know it isn't empty.

Thanks to anyone who can help with this.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 210
Default Pasting pictures from Excel to Word (2000)

Jim, thanks for your suggestion. It solved that problem -
The code didn't know which selection to paste to, so I was able to fix that.
I've run into a another problem at the last part of my code - here is the
entire sub:

Private Sub Print_BL_Click()
'On Error Resume Next
Dim WordApp As Word.Application, BlankBL As Word.Document
Dim SaveWSName As String, BLNumber As String, SaveDocName As String
Application.Goto Reference:="BL_Number"
BLNumber = ActiveCell
SaveWSName = "\\Path\JIT001-" & BLNumber & ".xls"
ActiveWorkbook.SaveAs Filename:=SaveWSName, FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
Application.Goto Reference:="Print_Area"
Selection.Copy
SaveDocName = "\\Path\BILL OF LADING#" & BLNumber & ".doc"
On Error Resume Next
Set WordApp = GetObject(, "Word.Application")
If WordApp Is Nothing Then
Set WordApp = New Word.Application
End If
On Error GoTo 0
If WordApp Is Nothing Then
MsgBox "Unable to load Word!", vbExclamation
End If
WordApp.Documents.Open "\\Path\BlankBL.doc"
WordApp.Visible = True
With WordApp.Selection
.PasteSpecial Link:=False, DataType:=wdPasteEnhancedMetafilePicture, _
Placement:=1, DisplayAsIcon:=False
End With
ActiveDocument.SaveAs Filename:=SaveDocName, _
FileFormat:=wdFormatDocument, LockComments:=False, Password:="", _
AddToRecentFiles:=True, WritePassword:="",
ReadOnlyRecommended:=False, _
EmbedTrueTypeFonts:=False, SaveNativePictureFormat:=False, _
SaveFormsData:=False, SaveAsAOCELetter:= False

I'm getting a compile error at the next line, "Named Argument Not Found"
with "Filename:="" highlighted:

WordApp.ActiveDocument.PrintOut Filename:="",
Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=3, Pages:="",
PageType:=wdPrintAllPages, _
Collate:=True, Background:=True, PrintToFile:=False,
PrintZoomColumn:=0, _
PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0

Is this because I used FileName:=SaveDocName in the Save routine just above
this line? Below is the end of the Sub:

WordApp.Quit
Set BlankBL = Nothing
Set WordApp = Nothing
End Sub

I'm getting a
"Jim Cone" wrote:

Robin,

Are you doing this from Excel or from Word?
How are you opening the "other" application?

What I am getting at is... Are you sure you know
what "Selection" is referring to?

Jim Cone
San Francisco, USA


"Robin" wrote in message
...
I am trying to copy from Excel 2000 as a picture and then paste into Word
2000 as a picture. My code will select the contiguous range, but when it
gets to this command:

Selection.CopyPicture Appearance:=xlScreen, Size:=xlScreen,
Format:=xlPicture

I get a run-time error 1004: Application-Defined or Object-Defined Error. I
haven't been able to determine which object is causing this error.

I tried earlier to simply copy the selection in Excel and PasteSpecial into
Word, but nothing seems to get pasted, even thought the code opens the
correct document. When the code finishes, I can manually paste the clipboard
contents, so I know it isn't empty.

Thanks to anyone who can help with this.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Pasting pictures from Excel to Word (2000)

Robin,

According to my Word help file the "FileName" argument is only used
when the Application is printed, not when the ActiveDocument is
printed. Just remove it (and the comma).

Regards,
Jim Cone
San Francisco, USA


"Robin" wrote in message
...
Jim, thanks for your suggestion. It solved that problem -
The code didn't know which selection to paste to, so I was able to fix that.
I've run into a another problem at the last part of my code - here is the
entire sub:

Private Sub Print_BL_Click()


- snip -

I'm getting a compile error at the next line, "Named Argument Not Found"
with "Filename:="" highlighted:

WordApp.ActiveDocument.PrintOut Filename:="",
Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=3, Pages:="",
PageType:=wdPrintAllPages, _
Collate:=True, Background:=True, PrintToFile:=False,
PrintZoomColumn:=0, _
PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0

Is this because I used FileName:=SaveDocName in the Save routine just above
this line? Below is the end of the Sub:

WordApp.Quit
Set BlankBL = Nothing
Set WordApp = Nothing
End Sub




"Jim Cone" wrote:

Robin,
Are you doing this from Excel or from Word?
How are you opening the "other" application?
What I am getting at is... Are you sure you know
what "Selection" is referring to?
Jim Cone
San Francisco, USA




"Robin" wrote in message
...
I am trying to copy from Excel 2000 as a picture and then paste into Word
2000 as a picture. My code will select the contiguous range, but when it
gets to this command:

Selection.CopyPicture Appearance:=xlScreen, Size:=xlScreen,
Format:=xlPicture

I get a run-time error 1004: Application-Defined or Object-Defined Error. I
haven't been able to determine which object is causing this error.

I tried earlier to simply copy the selection in Excel and PasteSpecial into
Word, but nothing seems to get pasted, even thought the code opens the
correct document. When the code finishes, I can manually paste the clipboard
contents, so I know it isn't empty.

Thanks to anyone who can help with this.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 210
Default Pasting pictures from Excel to Word (2000)

Thanks, Jim! Got everything working now. I appreciate all you help.

"Jim Cone" wrote:

Robin,

According to my Word help file the "FileName" argument is only used
when the Application is printed, not when the ActiveDocument is
printed. Just remove it (and the comma).

Regards,
Jim Cone
San Francisco, USA


"Robin" wrote in message
...
Jim, thanks for your suggestion. It solved that problem -
The code didn't know which selection to paste to, so I was able to fix that.
I've run into a another problem at the last part of my code - here is the
entire sub:

Private Sub Print_BL_Click()


- snip -

I'm getting a compile error at the next line, "Named Argument Not Found"
with "Filename:="" highlighted:

WordApp.ActiveDocument.PrintOut Filename:="",
Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=3, Pages:="",
PageType:=wdPrintAllPages, _
Collate:=True, Background:=True, PrintToFile:=False,
PrintZoomColumn:=0, _
PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0

Is this because I used FileName:=SaveDocName in the Save routine just above
this line? Below is the end of the Sub:

WordApp.Quit
Set BlankBL = Nothing
Set WordApp = Nothing
End Sub




"Jim Cone" wrote:

Robin,
Are you doing this from Excel or from Word?
How are you opening the "other" application?
What I am getting at is... Are you sure you know
what "Selection" is referring to?
Jim Cone
San Francisco, USA




"Robin" wrote in message
...
I am trying to copy from Excel 2000 as a picture and then paste into Word
2000 as a picture. My code will select the contiguous range, but when it
gets to this command:

Selection.CopyPicture Appearance:=xlScreen, Size:=xlScreen,
Format:=xlPicture

I get a run-time error 1004: Application-Defined or Object-Defined Error. I
haven't been able to determine which object is causing this error.

I tried earlier to simply copy the selection in Excel and PasteSpecial into
Word, but nothing seems to get pasted, even thought the code opens the
correct document. When the code finishes, I can manually paste the clipboard
contents, so I know it isn't empty.

Thanks to anyone who can help with this.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you export pictures from my pictures file into a word docu Becky New Users to Excel 1 November 20th 09 07:02 PM
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? [email protected] Excel Discussion (Misc queries) 2 September 10th 08 11:07 AM
PROBLEM:How to squeeze 2 Page sized Chart in Excel 2000 & embed in Word 2000 and print from Word to fit one page ??? [email protected] New Users to Excel 2 September 10th 08 11:07 AM
How do I set up a list box in excel 2000 to show pictures? Markymark Excel Worksheet Functions 0 April 30th 07 11:00 AM
Pictures in comments - Excel 2000 Bwasp Excel Worksheet Functions 2 February 10th 05 02:44 AM


All times are GMT +1. The time now is 02:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"