Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel file with Memo fields
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01544667
Message ID:
01544710
Views:
55
This message has been marked as a message which has helped to the initial question of the thread.
Likes (1)
>>Naomi, the only way I was ever able to get excel columns to not get truncated when importing to DBF was to use Excel automation.
>
>Can you please post your program if that's not too much to ask? I found one old program of mine, but it errors out.

Tried to grab the bits that were important... some adjustment will be necessary.
TRY
	oExcel=CREATEOBJECT("Excel.Application")
	oExcel.Workbooks.Open(lcFileNameWithPath,.F.,.T.)
CATCH TO oErr
	MESSAGEBOX("Error: "+ALLTRIM(oErr.message),0+64+0,_screen.Caption)
ENDTRY

FOR lnRow=1 TO lnExcelRows
	FOR lnColumn=1 TO lnExcelColumns
		TRY
			IF lnColumn<=26		&& Single letter column
				lcExcelColumn=CHR(64+lnColumn)
			ELSE			&& double letter column starting with "A"
				lcExcelColumn="A"+CHR(64+(lnColumn-26))
			ENDIF
			
			lcCellValue=NVL(oExcel.Range(lcExcelColumn+ALLTRIM(STR(lnRow+1))).Value,"")
		CATCH TO oErr
			MESSAGEBOX("Error encountered with Excel automation: "+ALLTRIM(oErr.message),0+64+0,_screen.Caption)
			lcCellValue=""
		ENDTRY
	ENDFOR
ENDFOR

oExcel.Workbooks.Close()
RELEASE oExcel
Brandon Harker
Sebae Data Solutions
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform