Import Excel to Datagridview

I am posting a solution for both Excel 2003 and Excel 2007+. You are missing ‘ in Extended Properties For Excel 2003 try this private void button1_Click(object sender, EventArgs e) { String name = “Items”; String constr = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=” + “C:\\Sample.xls” + “;Extended Properties=”Excel 8.0;HDR=YES;”;”; OleDbConnection con = new OleDbConnection(constr); OleDbCommand oconn = new … Read more

Delete Hidden/Invisible Rows after Autofilter Excel VBA

So I was kind of looking to get rid of Unfiltered Data rather than trying to reverse all the criteria and delete the visible cells I would use this one: Sub RemoveHiddenRows() Dim oRow As Range, rng As Range Dim myRows As Range With Sheets(“Sheet3”) Set myRows = Intersect(.Range(“A:A”).EntireRow, .UsedRange) If myRows Is Nothing Then … Read more

Change HTML email body font type and size in VBA

I did a little research and was able to write this code: strbody = “<BODY style=font-size:11pt;font-family:Calibri>Good Morning;<p>We have completed our main aliasing process for today. All assigned firms are complete. Please feel free to respond with any questions.<p>Thank you.</BODY>” apparently by setting the “font-size=11pt” instead of setting the font size <font size=5>, It allows you … Read more

How to export an HTML table as a .xlsx file

A great client-side tool for exporting html tables to xlsx, xls, csv, or txt is TableExport by clarketm (me). It is a simple, easy-to-implement, full-featured library with a bunch of configurable properties and methods. Install $ npm install tableexport Usage TableExport(document.getElementsByTagName(“table”)); // OR using jQuery $(“table”).tableExport(); Documentation Sample apps to get you started TableExport + … Read more

Excel VBA For Each Worksheet Loop

Try to slightly modify your code: Sub forEachWs() Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets Call resizingColumns(ws) Next End Sub Sub resizingColumns(ws As Worksheet) With ws .Range(“A:A”).ColumnWidth = 20.14 .Range(“B:B”).ColumnWidth = 9.71 .Range(“C:C”).ColumnWidth = 35.86 .Range(“D:D”).ColumnWidth = 30.57 .Range(“E:E”).ColumnWidth = 23.57 .Range(“F:F”).ColumnWidth = 21.43 .Range(“G:G”).ColumnWidth = 18.43 .Range(“H:H”).ColumnWidth = 23.86 .Range(“i:I”).ColumnWidth = 27.43 … Read more