Using Visual Basic Programming Language (Built-in Excel) Write a code that gener
ID: 3793976 • Letter: U
Question
Using Visual Basic Programming Language (Built-in Excel)
Write a code that generates graphs using the stats in this excel file. Link - (https://www.dropbox.com/home?preview=Excel+Heavily+Modded+CSV.csv)
The program must output at least 6 graphs (you pick which one). Try to automate as much as possible and add comments for better understanding.
Paste your code as the answer to this question along with a screenshot of the output as proof that it did work.
Explanation / Answer
Try Dbopen() 'File name and path, here i used abc file 'to be stored in Bin directory in the sloution directory Filename = AppDomain.CurrentDomain.BaseDirectory & "abc.xls" 'check if file already exists then 'delete it to create a new file If File.Exists(Filename) Then File.Delete(Filename) End If If Not File.Exists(Filename) Then chkexcel = False 'create new excel application oexcel = CreateObject("Excel.Application") 'add a new workbook obook = oexcel.Workbooks.Add 'set the application alerts not 'to be displayed for confirmation oexcel.Application.DisplayAlerts = True 'check total sheets in workboob Dim S As Integer = oexcel.Application.Sheets.Count() 'leaving first sheet delete all the remaining sheets If S > 1 Then oexcel.Application.DisplayAlerts = False Dim J As Integer = S Do While J > 1 oexcel.Application.Sheets(J).delete() J = oexcel.Application.Sheets.Count() Loop End If 'to check the session of excel application chkexcel = True oexcel.Visible = True 'this procedure populate the sheet Generate_Sheet() 'save excel file obook.SaveAs(Filename) 'end application object and session osheet = Nothing oexcel.Application.DisplayAlerts = False obook.Close() oexcel.Application.DisplayAlerts = True obook = Nothing oexcel.Quit() oexcel = Nothing chkexcel = False 'mail excel file as an attachment automail("send.file@somedomain.com", _ "Auto Excel File", _ "any message", Filename) End If Catch ex As Exception 'mail error message automail("err.mail@somedomain.com", _ "Error Message", ex.Message, "") Finally Dbclose() End Try
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.