Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Importing to excel
Message
From
17/07/2008 13:40:47
 
 
To
17/07/2008 13:12:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
01331963
Message ID:
01332042
Views:
9
What if you try assigning WorkBooks and ActiveSheet to the object-variable and work referring to those variables from now on. I found that sometimes it works better that way. See example:
...
oWorkBook=oExcel.Workbooks.open(m.lcXLS)
oActiveSheet=oWorkbook.ActiveSheet
with oActiveSheet
	 .range(;
	.Cells(1,.UsedRange.columns.count+1), ;
		.Cells( alen(arrData),.UsedRange.columns.count+1)).value = getArrayRef('arrData')
	endwith
....
>I have never seen that error and I didn't understand a bit what the documentation is trying to say about it.
>Cetin
>
>>Cetin, hard to tell exactly what this is trying to do with the error I get on this line
>> .range(;
>> .Cells(1,.UsedRange.columns.count+1), ;
>>Message is "the class file (ACTIVEWORKBOOK)associated with this field cannot be found"
>>
>>
>>
>>>>This seems complex but am looking for ideas. I want to dump a daily vfp table that produces 1 column of data with x number of rows.
>>>>I want to import/append this 1 column into excel in the next available blank column. so each day the available blank column progresses such as A,B,C.....AA,BB,CC etc.
>>>
>>>Actually it's easy Tim. ie:
>>>
>>>rand(-1)
>>>create cursor xx (myData c(10))
>>>for ix = 1 to int(rand()*20)
>>>	insert into xx values (textmerge('Day <<m.ix>>'))
>>>endfor
>>>select * from xx into array arrData
>>>
>>>
>>>lcXLS = 'c:\MyFolder\myDays.xls'
>>>
>>>oExcel = createobject('Excel.Application')
>>>oExcel.visible = .t.
>>>if file(m.lcXLS)
>>>	oExcel.Workbooks.open(m.lcXLS)
>>>	with oExcel.ActiveWorkBook.ActiveSheet
>>>	 .range(;
>>>		.Cells(1,.UsedRange.columns.count+1), ;
>>>		.Cells( alen(arrData),.UsedRange.columns.count+1)).value = getArrayRef('arrData')
>>>	endwith
>>>else
>>>	oExcel.Workbooks.add
>>>	oExcel.ActiveWorkBook.saveas(m.lcXLS)
>>>	with oExcel.ActiveWorkBook.ActiveSheet
>>>	  .range(;
>>>		.Cells(1,1), ;
>>>		.Cells( alen(arrData),1)).value = getArrayRef('arrData')
>>>	endwith
>>>endif
>>>oExcel.ActiveWorkBook.save
>>>
>>>function getArrayRef(tcArrayName)
>>>	return @&tcArrayName
>>>
Cetin
Previous
Reply
Map
View

Click here to load this message in the networking platform