Click here to Skip to main content
15,917,702 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalmsdev compiler Pin
spingkoy23-Feb-04 21:22
spingkoy23-Feb-04 21:22 
GeneralRe: msdev compiler Pin
Prakash Nadar23-Feb-04 21:55
Prakash Nadar23-Feb-04 21:55 
GeneralRe: msdev compiler Pin
David Crow24-Feb-04 3:18
David Crow24-Feb-04 3:18 
QuestionHow to Get property value if it returns BSTR Pin
Inam23-Feb-04 20:32
Inam23-Feb-04 20:32 
Generalinstallshield vc++ Pin
rasha200323-Feb-04 20:22
rasha200323-Feb-04 20:22 
Questionchange font style and colors in spreadsheet? Pin
xxhimanshu23-Feb-04 19:13
xxhimanshu23-Feb-04 19:13 
Questionchange font style and colors in excel spreadsheet? Pin
xxhimanshu23-Feb-04 19:12
xxhimanshu23-Feb-04 19:12 
AnswerRe: change font style and colors in excel spreadsheet? Pin
Monty223-Feb-04 19:46
Monty223-Feb-04 19:46 
A Snippet of code from a junk app of mine :-

//Start a new workbook in Excel
_Application oApp;
oApp.CreateDispatch("Excel.Application");
if (!oApp)
{
	AfxMessageBox("Cannot start Excel");
	return;
}
		
Workbooks oBooks = oApp.GetWorkbooks();
_Workbook oBook = oBooks.Add(vOpt);
Worksheets oSheets = oBook.GetWorksheets();
_Worksheet oSheet = oSheets.GetItem(COleVariant((short)1));
Range oRange;
long bMergeAcross = 0;
//prepare style
Styles styles = oBook.GetStyles();
			
Style s = styles.Add("Style with Center Text", vOpt);
		
s.SetVerticalAlignment(2);
s.SetHorizontalAlignment(3);
Font oFont = s.GetFont();
oFont.SetSize(COleVariant((long)FONT_SIZE_JUSTIFICATION));
	
VARIANT vt;
vt.vt = VT_DISPATCH;
vt.pdispVal = s.m_lpDispatch;

//use vt as a new style
oRange.SetStyle(vt);
		
oRange=oSheet.GetRange(COleVariant("A1"),COleVariant("A2"));
oFont = oRange.GetFont();
oFont.SetBold(COleVariant((short)TRUE));


Hope this helps Smile | :)
By the way you will have to import the type library to use these classes

For more help

Click it[^]


C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
GeneralGetting ENTER key to act like TAB Pin
rhealana23-Feb-04 18:35
rhealana23-Feb-04 18:35 
GeneralRe: Getting ENTER key to act like TAB Pin
Monty223-Feb-04 19:51
Monty223-Feb-04 19:51 
GeneralRe: Getting ENTER key to act like TAB Pin
rhealana24-Feb-04 16:43
rhealana24-Feb-04 16:43 
GeneralRe: Getting ENTER key to act like TAB Pin
Roger Allen24-Feb-04 3:52
Roger Allen24-Feb-04 3:52 
GeneralRe: Getting ENTER key to act like TAB Pin
rhealana24-Feb-04 16:43
rhealana24-Feb-04 16:43 
QuestionHow to get Windows Login Information in MFC Pin
.NetRams23-Feb-04 18:02
.NetRams23-Feb-04 18:02 
AnswerRe: How to get Windows Login Information in MFC Pin
Michael Dunn23-Feb-04 19:04
sitebuilderMichael Dunn23-Feb-04 19:04 
GeneralI need a method to check yahoo mail from vc application. Pin
mctpursuer23-Feb-04 18:00
mctpursuer23-Feb-04 18:00 
GeneralUser Message Pin
NadAzur23-Feb-04 16:02
NadAzur23-Feb-04 16:02 
GeneralRe: User Message Pin
Prakash Nadar23-Feb-04 16:49
Prakash Nadar23-Feb-04 16:49 
GeneralRe: User Message Pin
NadAzur23-Feb-04 17:12
NadAzur23-Feb-04 17:12 
GeneralRe: User Message Pin
Prakash Nadar23-Feb-04 17:27
Prakash Nadar23-Feb-04 17:27 
GeneralRe: User Message Pin
NadAzur23-Feb-04 17:31
NadAzur23-Feb-04 17:31 
GeneralRe: User Message Pin
Prakash Nadar23-Feb-04 17:51
Prakash Nadar23-Feb-04 17:51 
GeneralRe: User Message Pin
NadAzur23-Feb-04 18:49
NadAzur23-Feb-04 18:49 
GeneralRebar - toolbars overlapping problem Pin
Kayembi23-Feb-04 14:31
Kayembi23-Feb-04 14:31 
GeneralRe: Rebar - toolbars overlapping problem Pin
Kayembi24-Feb-04 0:09
Kayembi24-Feb-04 0:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.