Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hidden columns in Excel
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01146393
Message ID:
01146437
Views:
18
>Hi everybody,
>
>I'm converting xls into dbf. I have the following piece of code:
>
>
>for lnI = 1 to m.lnCols
>					.Cells(1,laFieldNames[m.lnI,3]).value = laFieldNames[m.lnI,1]
>					try
>						if .range(chr(64 + m.lnI) + ":" + chr(64 + m.lnI)).columns.columnwidth < 50
>							.range(chr(64 + m.lnI) + ":" + chr(64 + m.lnI)).columns.columnwidth = ;
>								.range(chr(64 + m.lnI) + ":" + chr(64 + m.lnI)).columns.columnwidth * 5 && To make sure long descriptions fit
>						endif
>					catch to loRangeProblem
>* Let's ignore this error with the range and column width
>					endtry
>				next
>
>I found that several columns were hidden. They didn't end up in the resulting dbf. What should I do to make sure all columns are in my table?
>
>I also have another question. How can I lock the row with the headers when I output dbf to Excel?
>
>Thanks in advance.

Unhide colums with:
LOCAL oExcel AS Excel.Application
oExcel = CREATEOBJECT([Excel.Application])
oExcel.Workbooks.Add()
oExcel.Columns([B:C]).Select
oExcel.Selection.EntireColumn.Hidden = .t.  && Hide columns B and C
oExcel.Visible = .t.
INKEY(0)
oExcel.Columns([A:IV]).Select
oExcel.Selection.EntireColumn.Hidden = .f.  && Unhide all hidden columns
INKEY(0)
*** Freeze first row of sheet
oExcel.Rows("2:2").Select
oExcel.ActiveWindow.FreezePanes = .t.
INKEY(0)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform