Jason_Moffitt
New Member
- Joined
- Oct 24, 2008
- Messages
- 8
<HR style="COLOR: #ffffff; BACKGROUND-COLOR: #ffffff" SIZE=1><!-- / icon and title --><!-- message -->I have a spreadsheet that pulls reporting values based on the data validation list that I pull down in one of the cells. Once the calculation occurs and updates all the information...mainly graphs, I want to grab the print area, copy it and then paste it as a picture into a word document.
In the posts I have seen in the past, most comments go towards, simply record your actions in word after you load the reference and you should be fine...however, I get an error when trying to post as a picture...I can do a standard paste just fine, but then the formatting and size of the report within Word is completely messed up.
Any thoughts on why I would get this error, or what command I should use instead?
error is: Microsoft Visual Basic, Run Time error '4605': This command is not available
code is below
Quote:
<TABLE cellSpacing=0 cellPadding=6 width="100%" border=0><TBODY><TR><TD class=alt2 style="BORDER-RIGHT: 1px inset; BORDER-TOP: 1px inset; BORDER-LEFT: 1px inset; BORDER-BOTTOM: 1px inset">Sub Generate_Report_Test()
'
'To scan through selected reports choices, generate reports and paste into a word
'document as pictures to be sent to team
'turn off screen flicker while macro is running
'Application.ScreenUpdating = False
Range("D2").Select
Range("F2").Select
Calculate
'copy Report Data
Range("B4:G26").Select
Selection.Copy
'starting Word document
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim i As Integer
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Add
'set up page settings for report
With wrdDoc.PageSetup
.Orientation = wdOrientLandscape
.TopMargin = InchesToPoints(0.7)
.BottomMargin = InchesToPoints(0.7)
.LeftMargin = InchesToPoints(0.7)
.RightMargin = InchesToPoints(0.7)
End With
'Paste Report Data
With wrdDoc
wrdApp.Selection.PasteAndFormat wdChartPicture 'this is highlighted error
wrdApp.Selection.TypeParagraph
End With
</TD></TR></TBODY></TABLE>
In the posts I have seen in the past, most comments go towards, simply record your actions in word after you load the reference and you should be fine...however, I get an error when trying to post as a picture...I can do a standard paste just fine, but then the formatting and size of the report within Word is completely messed up.
Any thoughts on why I would get this error, or what command I should use instead?
error is: Microsoft Visual Basic, Run Time error '4605': This command is not available
code is below
Quote:
<TABLE cellSpacing=0 cellPadding=6 width="100%" border=0><TBODY><TR><TD class=alt2 style="BORDER-RIGHT: 1px inset; BORDER-TOP: 1px inset; BORDER-LEFT: 1px inset; BORDER-BOTTOM: 1px inset">Sub Generate_Report_Test()
'
'To scan through selected reports choices, generate reports and paste into a word
'document as pictures to be sent to team
'turn off screen flicker while macro is running
'Application.ScreenUpdating = False
Range("D2").Select
Range("F2").Select
Calculate
'copy Report Data
Range("B4:G26").Select
Selection.Copy
'starting Word document
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim i As Integer
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Add
'set up page settings for report
With wrdDoc.PageSetup
.Orientation = wdOrientLandscape
.TopMargin = InchesToPoints(0.7)
.BottomMargin = InchesToPoints(0.7)
.LeftMargin = InchesToPoints(0.7)
.RightMargin = InchesToPoints(0.7)
End With
'Paste Report Data
With wrdDoc
wrdApp.Selection.PasteAndFormat wdChartPicture 'this is highlighted error
wrdApp.Selection.TypeParagraph
End With
</TD></TR></TBODY></TABLE>