Re: Asc Values
And this way.
ex_ascii function.txt
And this way.
Code:
'Date Created: 09-Jan-2003 08:35:07 PM 'Last Updated: 08-Sep-2016 07:15:03 AM 'Created By : John Magno - http://www.JohnMagno.com 'Updated By : SMathews 'sample usage ex_ascii("C:\temp\newasc.xls","Brush Script") 'output will be saved as C:\temp\newasc_Brush Script.xls FUNCTION ex_ascii AS L (filename AS C, fontname as C ) ex_ascii = .F. final_filename = strtran(filename,".xls","_"+fontname+".xls") Dim xlApp as p dim myCell as c xlApp = ole.GetObject("","Excel.Application") xlApp.Workbooks.Add() 'debug(1) 'xlApp.Visible = .T. 'comment this line out if you don't want to see Excel row_ctr = 7 qx = 1 while qx < 254 xlApp.Range("A"+alltrim(str(row_ctr))).Select() xlApp.ActiveCell.formula = qx xlApp.Range("B"+alltrim(str(row_ctr))).Select() xlApp.ActiveCell.formula = "=char(A"+alltrim(str(row_ctr))+")" xlApp.Range("C"+alltrim(str(row_ctr))).Select() xlApp.ActiveCell.formula = qx+1 xlApp.Range("D"+alltrim(str(row_ctr))).Select() xlApp.ActiveCell.formula = "=char(C"+alltrim(str(row_ctr))+")" xlApp.Range("E"+alltrim(str(row_ctr))).Select() xlApp.ActiveCell.formula = qx+2 xlApp.Range("F"+alltrim(str(row_ctr))).Select() xlApp.ActiveCell.formula = "=char(E"+alltrim(str(row_ctr))+")" if qx+3 > 255 exit while end if xlApp.Range("G"+alltrim(str(row_ctr))).Select() xlApp.ActiveCell.formula = qx+3 xlApp.Range("H"+alltrim(str(row_ctr))).Select() xlApp.ActiveCell.formula = "=char(G"+alltrim(str(row_ctr))+")" xlApp.Range("I"+alltrim(str(row_ctr))).Select() xlApp.ActiveCell.formula = qx+4 xlApp.Range("J"+alltrim(str(row_ctr))).Select() xlApp.ActiveCell.formula = "=char(I"+alltrim(str(row_ctr))+")" xlApp.Range("K"+alltrim(str(row_ctr))).Select() xlApp.ActiveCell.formula = qx+5 xlApp.Range("L"+alltrim(str(row_ctr))).Select() xlApp.ActiveCell.formula = "=char(K"+alltrim(str(row_ctr))+")" qx = qx + 6 row_ctr = row_ctr+1 end while xlApp.Range("A7:A49").Select() xlApp.Selection.Font.Name = "Arial" xlApp.Selection.Font.FontStyle = "Regular" xlApp.Selection.Font.Size = 14 xlApp.Range("B7:B49").Select() xlApp.Selection.Font.Name = fontname xlApp.Selection.Font.FontStyle = "Regular" xlApp.Selection.Font.Size = 14 xlApp.Range("C7:C49").Select() xlApp.Selection.Font.Name = "Arial" xlApp.Selection.Font.FontStyle = "Regular" xlApp.Selection.Font.Size = 14 xlApp.Range("D7:D49").Select() xlApp.Selection.Font.Name = fontname xlApp.Selection.Font.FontStyle = "Regular" xlApp.Selection.Font.Size = 14 xlApp.Range("E7:E49").Select() xlApp.Selection.Font.Name = "Arial" xlApp.Selection.Font.FontStyle = "Regular" xlApp.Selection.Font.Size = 14 xlApp.Range("F7:F49").Select() xlApp.Selection.Font.Name = fontname xlApp.Selection.Font.FontStyle = "Regular" xlApp.Selection.Font.Size = 14 xlApp.Range("G7:G49").Select() xlApp.Selection.Font.Name = "Arial" xlApp.Selection.Font.FontStyle = "Regular" xlApp.Selection.Font.Size = 14 xlApp.Range("H7:H49").Select() xlApp.Selection.Font.Name = fontname xlApp.Selection.Font.FontStyle = "Regular" xlApp.Selection.Font.Size = 14 xlApp.Range("I7:I49").Select() xlApp.Selection.Font.Name = "Arial" xlApp.Selection.Font.FontStyle = "Regular" xlApp.Selection.Font.Size = 14 xlApp.Range("J7:J49").Select() xlApp.Selection.Font.Name = fontname xlApp.Selection.Font.FontStyle = "Regular" xlApp.Selection.Font.Size = 14 xlApp.Range("K7:K49").Select() xlApp.Selection.Font.Name = "Arial" xlApp.Selection.Font.FontStyle = "Regular" xlApp.Selection.Font.Size = 14 xlApp.Range("L7:L49").Select() xlApp.Selection.Font.Name = fontname xlApp.Selection.Font.FontStyle = "Regular" xlApp.Selection.Font.Size = 14 xlApp.Range("A2").Select() xlApp.Selection.Formula = fontname xlapp.DisplayAlerts = .F. xlApp.ActiveWorkbook.SaveAs(final_filename,56) xlApp.Workbooks.Close() xlapp.DisplayAlerts = .T. xlApp.Quit() delete xlApp ex_ascii = .T. END FUNCTION
Comment