Work needs, I just started to learn VFP, also please help diagnosis, thank you!
The code is as follows:
Local cFilepath
CFilepath=Thisform. Text1. Value
If the Empty (cFilepath)
Messagebox (please specify the file "", 64," tip ")
The Else
OExcel=Createobject (' Excel. Application ')
OExcel. Workbooks. Open (cFilepath)
SSheetname=oExcel. Application. Activesheet. Name & amp; & Gets the current worksheet name
OExcel. Worksheets (sSheetname). Activate & amp; & Activate the worksheet
IRowscount=oExcel. Worksheets (oExcel. Sheets (1). The Name). Usedrange. Rows. Count & amp; & Have data to the total number of rows
Icolumns=oExcel. Worksheets (oExcel. Sheets (1). The Name). Usedrange. Columns. Count & amp; & With the total number of columns of data
OExcel. Range (oExcel. Activesheet. Cells (1, 1), oExcel. Activesheet. Cells (iRowscount icolumns)). Select & amp; & The selected data
OExcel. Selection. NumberFormatLocal="@" & amp; & Set by the selected cell to text format
OExcel. Columns. AutoFit & amp; & Let all the column widths automatically adjust
OExcel. DisplayAlerts=. F. & amp; & Don't show the warning
OExcel. ActiveWorkbook. SaveAs (' D: \ TEST. DBF, 8) & amp; & Save as DBF
OExcel. ActiveWorkbook. Saved=. T. & amp; & Do not save the current EXCEL table
OExcel. Workbooks. Close & amp; & Close the table
Thisform. Grid1. Refresh
Endif
CodePudding user response:
OExcel. Activesheet. Cells. The NumberFormat="@"