Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copying to Excel
Message
From
20/10/2006 16:39:36
 
 
To
20/10/2006 14:39:16
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01163724
Message ID:
01163752
Views:
9
This message has been marked as the solution to the initial question of the thread.
Jos, I am not sure about images to the clipboard. Are these in your cursor? I think it would work anyway with this example
this is the way I do it
PUBLIC loExcel AS "excel.application"
LOCAL loWorkBook, loRange
loExcel =CREATEOBJECT("Excel.Application")
WITH loExcel
	loExcel.Workbooks.OPEN(lcDir) && open in directory
	.DisplayAlerts = .F.
	.VISIBLE = .T.
	.ActiveSheet.NAME = "First Sheet"  && name it
	.Sheets.ADD  && create it
	.Sheets("Sheet1").SELECT
	.Sheets("Sheet1").NAME = "Second Sheet"
	.RANGE("C8").SELECT
	.ActiveSheet.Paste && something copied from calling prog.
ENDWITH
SELECT &lcLoginTime && new set of items
_VFP.DATATOCLIP(,,3) && copy to clip
WITH loExcel
	.Sheets.ADD
	.Sheets("Sheet2").SELECT
	.Sheets("Sheet2").NAME = "Third sheet"
	.RANGE("C8").SELECT
	.ActiveSheet.Paste
	.COLUMNS("D:D").SELECT
	.ActiveWorkbook.SAVE()
QUIT
ENDWITH
>Hi All
>
>I want to put various content, some text, some graphic images, into consecutive worksheets of a new spreadsheet. I was thinking of automating the creation of a new xls file, copying the text (or the image) to the clipboard and then adding a worksheet, and then pasting the clipoard into the worksheet, then repeat for each block of text or image that I want to put into the excel file. How does one;
>
>a) create a new worksheet,
>
>b) paste the contents of the clipbaord into the worksheet created above
>
>I could work it out with intellisense but I'm looking for best practice and suggestions as I need this ready for a presentation Monday morning :)
>
>Thanks.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform