Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Yousfi Benameur
  Where is Yousfi Benameur?
 El Bayadh
 Algeria
 Yousfi Benameur
 To: Jun Tangunan
  Where is Jun Tangunan?
 Cabanatuan
 Philippines
 Jun Tangunan
 Tags
Subject: RE: Chart Manipulation on Excel 2007 -solved
Thread ID: 269039 Message ID: 269068 # Views: 30 # Ratings: 1
Version: Visual FoxPro 9 Category: Active X Controls & OLE Automation
Date: Friday, July 16, 2010 10:20:39 AM         
   


> Hello guys,
>
> I decided to create a chart today using Excel 2007 via automation and I have made it with one exception, how to place the legends at the bottom of the chart. VBA Script shows me this:
>
>
ActiveChart.SetElement(msoElementLegendBottom)
> 

>
> Problem is, I got stuck trying to find the value of msoElementLegendBottom. It can also not be seen in Excel constants. Anyone has an idea of its value? In the meantime I don't have a choice but to manually test several values which is what I have been doing for almost an hour now, still to no avail.
>
> Thank you!
>
> - Update -
>
> A few minutes after posting, I hit the values, LOL!
>
> For legends to appear on Top, Right, Left and Bottom; use 101 to 104. 104 is msoElementLegendBottom.
>
>
>
>
> http://www.junblogs.com/
> http://weblogs.foxite.com/sandstorm36/default.aspx
> http://www.coderisland.com/forum/viewforum.php?f=10

for who not having object browser (vfp5,6...) you can use this code to extract the excel constants to a h file (from OLB file localised in the office12 folder)
Excuse me i forget the author,its a few old..
Also you can get all cosntants of word,outlook,powerpoint,excel.....office applications having olb files.

*!*--START CODE

PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.SHOW
RETURN

DEFINE CLASS form1 AS FORM
	HEIGHT = 445
	WIDTH = 567
	DOCREATE = .T.
	AUTOCENTER = .T.
	BORDERSTYLE = 1
	CAPTION = ".OLB Constants Extractor"
	MAXBUTTON = .F.
	MINBUTTON = .F.
	NAME = "Form1"

	ADD OBJECT txtolbfile AS TEXTBOX WITH ;
		HEIGHT = 27, ;
		LEFT = 65, ;
		READONLY = .T., ;
		TABINDEX = 2, ;
		TOP = 6, ;
		WIDTH = 458, ;
		NAME = "txtOLBFILE"

	ADD OBJECT label1 AS LABEL WITH ;
		AUTOSIZE = .T., ;
		CAPTION = ".\<OLB File:", ;
		HEIGHT = 17, ;
		LEFT = 4, ;
		TOP = 11, ;
		WIDTH = 55, ;
		TABINDEX = 1, ;
		NAME = "Label1"

	ADD OBJECT cmdsave AS COMMANDBUTTON WITH ;
		TOP = 411, ;
		LEFT = 394, ;
		HEIGHT = 27, ;
		WIDTH = 84, ;
		CAPTION = "\<Save to .h", ;
		ENABLED = .F., ;
		TABINDEX = 6, ;
		NAME = "cmdSAVE"

	ADD OBJECT cmdquit AS COMMANDBUTTON WITH ;
		TOP = 411, ;
		LEFT = 480, ;
		HEIGHT = 27, ;
		WIDTH = 84, ;
		CAPTION = "\<Quit", ;
		TABINDEX = 7, ;
		NAME = "cmdQUIT"

	ADD OBJECT edtconstants AS EDITBOX WITH ;
		HEIGHT = 347, ;
		LEFT = 6, ;
		READONLY = .T., ;
		TABINDEX = 4, ;
		TOP = 52, ;
		WIDTH = 558, ;
		NAME = "edtConstants"

	ADD OBJECT cmdgetfile AS COMMANDBUTTON WITH ;
		TOP = 6, ;
		LEFT = 533, ;
		HEIGHT = 27, ;
		WIDTH = 26, ;
		CAPTION = "...", ;
		TABINDEX = 3, ;
		NAME = "cmdGETFILE"

	ADD OBJECT cmdextract AS COMMANDBUTTON WITH ;
		TOP = 411, ;
		LEFT = 280, ;
		HEIGHT = 27, ;
		WIDTH = 110, ;
		CAPTION = "\<Extract Constants", ;
		ENABLED = .F., ;
		TABINDEX = 5, ;
		NAME = "cmdEXTRACT"


	PROCEDURE cmdsave.CLICK
		STRTOFILE(THISFORM.edtconstants.VALUE,PUTFILE([Header File], ;
			JUSTSTEM(THISFORM.txtolbfile.VALUE) + [.h],[.h]))
	ENDPROC

	PROCEDURE cmdquit.CLICK
		THISFORM.RELEASE
	ENDPROC

	PROCEDURE cmdgetfile.CLICK
		LOCAL lcOLBFile

		lcOLBFile = GETFILE([OLB],[OLB File],[Open])
		IF EMPTY(lcOLBFile)
			RETURN .F.
		ENDIF
		
		IF UPPER(RIGHT(lcOLBFile,3)) # [OLB]
			MESSAGEBOX([Invalid File],0,[])
			RETURN .F.
		ENDIF

		THISFORM.txtolbfile.VALUE = lcOLBFile
		THISFORM.cmdextract.ENABLED= .T.
	ENDPROC

	PROCEDURE cmdextract.CLICK
		WAIT WINDOW [Processing...] NOCLEAR NOWAIT
		LOCAL oTLB_INFO, oConstants, lcConstantsStr, Obj, member
		#DEFINE CRLF CHR(13) + CHR(10)

		oTLB_INFO = CREATEOBJECT([tli.typelibinfo])
		oTLB_INFO.ContainingFile = (THISFORM.txtolbfile.VALUE)

		oConstants = oTLB_INFO.Constants

		lcConstantsStr = []
		FOR EACH Obj IN oTLB_INFO.Constants
                        lcConstantsStr = lcConstantsStr + CRLF + "* " + Obj.Name + CRLF   
                        FOR EACH member IN Obj.Members
                            lcConstantsStr = lcConstantsStr + [#DEFINE ] + ;
                            member.NAME + [ ] + ;
                            TRANSFORM(member.VALUE) + CRLF
                        NEXT member
		NEXT Obj

		THISFORM.edtconstants.VALUE=lcConstantsStr
		THISFORM.cmdsave.ENABLED= .T.
		WAIT CLEAR
		WAIT WINDOW [Complete!] TIMEOUT 2
	ENDPROC

ENDDEFINE
*!*--END CODE




if you need only some constants select directly on the form each one and CTRL+C (copied to the clipboard)....paste directly on your vfp code (incluse #define..)

Regards
Yousfi Benameur

ENTIRE THREAD

Chart Manipulation on Excel 2007 -solved Posted by Jun Tangunan @ 7/16/2010 8:09:23 AM
RE: Chart Manipulation on Excel 2007 -solved Posted by tushar @ 7/16/2010 9:16:08 AM
RE: Chart Manipulation on Excel 2007 -solved Posted by Jun Tangunan @ 7/16/2010 9:31:37 AM
RE: Chart Manipulation on Excel 2007 -solved Posted by tushar @ 7/16/2010 9:47:40 AM
RE: Chart Manipulation on Excel 2007 -solved Posted by Jun Tangunan @ 7/16/2010 10:14:12 AM
RE: Chart Manipulation on Excel 2007 -solved Posted by Yousfi Benameur @ 7/16/2010 10:06:57 AM
RE: Chart Manipulation on Excel 2007 -solved Posted by Jun Tangunan @ 7/16/2010 10:19:20 AM
RE: Chart Manipulation on Excel 2007 -solved Posted by tushar @ 7/16/2010 10:36:49 AM
RE: Chart Manipulation on Excel 2007 -solved Posted by Jun Tangunan @ 7/16/2010 10:43:04 AM
RE: Chart Manipulation on Excel 2007 -solved Posted by Samir H. @ 7/16/2010 11:27:09 AM
RE: Chart Manipulation on Excel 2007 -solved Posted by Jun Tangunan @ 7/16/2010 11:38:49 AM
RE: Chart Manipulation on Excel 2007 -solved Posted by Yousfi Benameur @ 7/16/2010 10:20:39 AM
RE: Chart Manipulation on Excel 2007 -solved Posted by Jun Tangunan @ 7/16/2010 10:29:05 AM