Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

Producing an Excel worksheet on a Word 2000 document

Sub MakeExcelChart()     Dim XLSheet As Object          Documents.Add     Wbook = "\projections.xls"     Set XLSheet = GetObject(Wbook, "Excel.Sheet").ActiveSheet          XLSheet.range("Value") = 1     XLSheet.range("Change") = 2     XLSheet.Calculate     Selection.Font.Size = 14     Selection.Font.Bold = True     Selection.TypeText "Monthly Increment: " & Format(2, "0.0%")     Selection.TypeParagraph     Selection.TypeParagraph     XLSheet.range("data").Copy     Selection.Paste          XLSheet.ChartObjects(1).Copy     Selection.PasteSpecial _         Link:=False, _         DataType:=wdPasteMetafilePicture, _         Placement:=wdInLine, DisplayAsIcon:=False          Set XLSheet = Nothing End Sub