Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with columns with long info in Excel
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Problem with columns with long info in Excel
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01152063
Message ID:
01152063
Views:
76
Hi everybody,

I'm trying to convert Excel file into DBF. I'm using fSplitIntoDBF function which is my modification of my colleague's code. I have a problem with columns that have long info (less than 255 chars, though). I'm trying this code:
for lnI = 1 to m.lnCols
   .Cells(1,laFieldNames[m.lnI,3]).value = laFieldNames[m.lnI,1]
   .columns[m.lnI].autofit()
   try
	if .columns[m.lnI].columnwidth < 50
** To make sure long descriptions fit
	.columns[m.lnI].columnwidth = .columns[m.lnI].columnwidth * 5	

         endif
   catch to loRangeProblem
* Let's ignore this error with the range and column width
   endtry
next
and later
*#DEFINE xlDBF3	8
*#DEFINE xlDBF4 11
loExcel.ActiveWorkbook.saveas(m.tcDbfFile, 11)
However, long columns are still truncated. The length of the info in the column is 175 chars, but my output file has only 110 chars. The other column also has just 112 chars, but it should be wider.

What would you suggest me to do? How can I make the column wide enough?

Thanks a lot in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform