Source language: Translate to:

Chart excel to image JPG VBS

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Chart excel to image JPG VBS

Postby alangonzalez91 » Mon Oct 16, 2017 4:55 pm

Encontre algo para fabricar un gráfico de torta hasta el momento, usando microsoft excel, todavia falta armar la funcion, pero esto es lo que encontre lo comparto con ustedes, solo deben copiar en una funcion de vbscript

I found something to make a pie chart so far, using microsoft excel, I still need to set up the function, but this is what I found I share with you, you should only copy in a vbscript function

'---------------------------------

Dim oExl,oWrkbk,oWrkst,oMychart

Set oExl=CreateObject("Excel.Application")

With oExl

'EXCEL NO VISIBLE
.Visible=False

End With

Set oWrkbk=oExl.Workbooks.Add()
Set oWrkst=oWrkbk.Worksheets(1)

With oWrkst
'TITULO - TITLE
.Cells(1,2)="GRAFICO EN EXCEL PARA NEOBOOK"

'NOMBRE DE DATOS - DATA NAMES
.Cells(2,1)="Very Serious"
.Cells(3,1)="Serious"
.Cells(4,1)="Moderate"
.Cells(5,1)="Mild"

'VALORES - VALUES
.Cells(2,2)=22
.Cells(3,2)=12
.Cells(4,2)=42
.Cells(5,2)=35


End With

Set oRange=oWrkst.UsedRange
oRange.Select
Set oChart=oExl.charts
oChart.Add()
Set oMychart=oChart(1)
oMychart.Activate
oMychart.ChartType=5 ' ---> TIPO DE GRAFICO 5, 69. 68, 80, -4120, -4102 --->https://msdn.microsoft.com/en-us/vba/excel-vba/articles/xlcharttype-enumeration-excel
oMychart.ApplyDataLabels 5 '---> TIPO DE ETIQUETA 2 - 6

'ESTILOS - STYLE
oMychart.PlotArea.Fill.Visible=False
oMychart.PlotArea.Border.LineStyle=-4142
oMychart.SeriesCollection(1).DataLabels.Font.Size=15
oMychart.SeriesCollection(1).DataLabels.Font.ColorIndex=2

'COLOR DE FONDO - BACK COLOR
oMychart.ChartArea.Fill.Forecolor.SchemeColor=58 ' 1-58 (58 WHITE BLANCO)
oMychart.ChartArea.Fill.Backcolor.SchemeColor=32 ' 1-58 (58 WHITE BLANCO)
oMychart.ChartArea.Fill.TwoColorGradient 1,1

'ESTILOS DE TITULO - TITLE STYLES
oMychart.ChartTitle.Font.Size=20
oMychart.ChartTitle.Font.ColorIndex=4
'oWrkbk.Close
Set oExl=Nothing

'ALERTAS - ALERTS

If err.number<>0 then

Msgbox "error occurred while drawing..."
Msgbox err.Description

Else

Msgbox "Successfully drawn"

End If


' EXPORTADO A C:\ `RUIEBA TEST CHAR.JPG - EXPORTED
oMychart.Export "c:\PRUEBA TEST CHAR.jpg", "JPG"

'--------------------------------------

greetings and blessings
Last edited by alangonzalez91 on Mon Oct 16, 2017 11:20 pm, edited 1 time in total.
alangonzalez91
 
Posts: 5
Joined: Sun Jun 13, 2010 12:52 pm
Location: Chaco - Argentina

Re: Char excel to image JPG VBS

Postby virger » Mon Oct 16, 2017 7:34 pm

Muchas graciaas.
Lo revisare y te cuento.
Nos vemos en Rusia
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 523
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest