Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Can this be done ?

Can the background's colour of the Excel Formula Bar be set ?

Unlike other objects in the Excel object model, the formula bar exposes a
window handle and a Class name "EXCEL;" so I thought maybe changing its
background colour could probably be achieved via some API calls .(
SendMessage or....)

Any ideas on this would be much appreciated .

Jaafar.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Can this be done ?


Jaafar,

Stop playing with Spy++ :)

else for similar creative code...but actually more use than changing
the color. Changing the width:

http://www.cpearson.com/excel/NameBox.htm
http://www.vbrad.com/pf.asp?p=source...el_namebox.htm


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


RAFAAJ2000 wrote :

Can the background's colour of the Excel Formula Bar be set ?

Unlike other objects in the Excel object model, the formula bar
exposes a window handle and a Class name "EXCEL;" so I thought maybe
changing its background colour could probably be achieved via some
API calls .( SendMessage or....)

Any ideas on this would be much appreciated .

Jaafar.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Can this be done ?

KeepITCool,......Thanks for the links :)

I already know about the NameBox code but I wanted to see more ways of
manipulating Excel objects trhough the API as there isn't enough information
available on this subject .

I bought myself a couple of books on VB/API but they are not written in a
clear methodical manner and offer very few examples. They show you snippets
of code but never go deep enough into showing you how they actually work so
you can start applying what you learn to new scenarios. They are also VB
oriented NOT VBA.

This makes it very difficult for anyone wanting to expand their knowledge of
using APIs with VBA\MSO applications.

Any suggestions as to how I could best further my knowledge in this area
would be much appreciated .

Thanks.

Jaafar.







"keepITcool" wrote:


Jaafar,

Stop playing with Spy++ :)

else for similar creative code...but actually more use than changing
the color. Changing the width:

http://www.cpearson.com/excel/NameBox.htm
http://www.vbrad.com/pf.asp?p=source...el_namebox.htm


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


RAFAAJ2000 wrote :

Can the background's colour of the Excel Formula Bar be set ?

Unlike other objects in the Excel object model, the formula bar
exposes a window handle and a Class name "EXCEL;" so I thought maybe
changing its background colour could probably be achieved via some
API calls .( SendMessage or....)

Any ideas on this would be much appreciated .

Jaafar.



"keepITcool" wrote:


Jaafar,

Stop playing with Spy++ :)

else for similar creative code...but actually more use than changing
the color. Changing the width:

http://www.cpearson.com/excel/NameBox.htm
http://www.vbrad.com/pf.asp?p=source...el_namebox.htm


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


RAFAAJ2000 wrote :

Can the background's colour of the Excel Formula Bar be set ?

Unlike other objects in the Excel object model, the formula bar
exposes a window handle and a Class name "EXCEL;" so I thought maybe
changing its background colour could probably be achieved via some
API calls .( SendMessage or....)

Any ideas on this would be much appreciated .

Jaafar.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Can this be done ?


use Winspector iso Spy++ (http://www.windows-spy.com/)
use ApiViewer 2004.

google google google.
experiment,experiment, experiment

Brad Martinez ans Randy Birch offer some good api coding.
(vbnet org)





--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


RAFAAJ2000 wrote :

KeepITCool,......Thanks for the links :)

I already know about the NameBox code but I wanted to see more ways
of manipulating Excel objects trhough the API as there isn't enough
information available on this subject .

I bought myself a couple of books on VB/API but they are not written
in a clear methodical manner and offer very few examples. They show
you snippets of code but never go deep enough into showing you how
they actually work so you can start applying what you learn to new
scenarios. They are also VB oriented NOT VBA.

This makes it very difficult for anyone wanting to expand their
knowledge of using APIs with VBA\MSO applications.

Any suggestions as to how I could best further my knowledge in this
area would be much appreciated .

Thanks.

Jaafar.







"keepITcool" wrote:


Jaafar,

Stop playing with Spy++ :)

else for similar creative code...but actually more use than changing
the color. Changing the width:

http://www.cpearson.com/excel/NameBox.htm
http://www.vbrad.com/pf.asp?p=source...el_namebox.htm


--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam



RAFAAJ2000 wrote :

Can the background's colour of the Excel Formula Bar be set ?

Unlike other objects in the Excel object model, the formula bar
exposes a window handle and a Class name "EXCEL;" so I thought
maybe changing its background colour could probably be achieved
via some API calls .( SendMessage or....)

Any ideas on this would be much appreciated .

Jaafar.



"keepITcool" wrote:


Jaafar,

Stop playing with Spy++ :)

else for similar creative code...but actually more use than changing
the color. Changing the width:

http://www.cpearson.com/excel/NameBox.htm
http://www.vbrad.com/pf.asp?p=source...el_namebox.htm


--
keepITcool
www.XLsupport.com | keepITcool chello nl | amsterdam



RAFAAJ2000 wrote :

Can the background's colour of the Excel Formula Bar be set ?

Unlike other objects in the Excel object model, the formula bar
exposes a window handle and a Class name "EXCEL;" so I thought
maybe changing its background colour could probably be achieved
via some API calls .( SendMessage or....)

Any ideas on this would be much appreciated .

Jaafar.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Can this be done ?


"RAFAAJ2000" skrev i en meddelelse
...

Any suggestions as to how I could best further my knowledge in this area
would be much appreciated .

Thanks.

Jaafar.




Hi Jaafar

Dan Appleman
Visual Basic Programmer's Guide to the Win32 API
SAMS
ISBN 0-672-31590-4

is *the* "Bible".


--
Best Regards
Leo Heuser

Followup to newsgroup only please.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Can this be done ?

Hi Rafaaj2000,

This makes it very difficult for anyone wanting to expand their knowledge of
using APIs with VBA\MSO applications.


Read chapter 9 of Professional Excel Development:
http://www.oaltd.co.uk/DLCount/DLCou...ExcelDev09.pdf

and see some of the other files on my site, many of which use API calls to
manipulate Excel.

Regards

Stephen Bullen
Microsoft MVP - Excel

Professional Excel Development
The most advanced Excel VBA book available
www.oaltd.co.uk/ProExcelDev


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Can this be done ?

Hi Rafaaj2000,

Can the background's colour of the Excel Formula Bar be set ?

Unlike other objects in the Excel object model, the formula bar exposes a
window handle and a Class name "EXCEL;" so I thought maybe changing its
background colour could probably be achieved via some API calls .(
SendMessage or....)


Sure, something like:

hWnd = FindWindowEx(Application.hWnd,0,"EXCEL<",vbnullstr ing)
hDC = GetDC(hWnd)
SetBkColor hDC, &h0000FF
ReleaseDC hWnd,hDC

N.B. "EXCEL<" is the class name of the edit box bit of the formula bar.

Regards

Stephen Bullen
Microsoft MVP - Excel

Professional Excel Development
The most advanced Excel VBA book available
www.oaltd.co.uk/ProExcelDev


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Can this be done ?

Thanks Stephen ,

Is the 'SetBKColor' a UDF ? if so, it is not defined in your code !
If it is an API Function why can't I find it on the API functions list ?!!

Thanks again.

Jaafar.


"Stephen Bullen" wrote:

Hi Rafaaj2000,

Can the background's colour of the Excel Formula Bar be set ?

Unlike other objects in the Excel object model, the formula bar exposes a
window handle and a Class name "EXCEL;" so I thought maybe changing its
background colour could probably be achieved via some API calls .(
SendMessage or....)


Sure, something like:

hWnd = FindWindowEx(Application.hWnd,0,"EXCEL<",vbnullstr ing)
hDC = GetDC(hWnd)
SetBkColor hDC, &h0000FF
ReleaseDC hWnd,hDC

N.B. "EXCEL<" is the class name of the edit box bit of the formula bar.

Regards

Stephen Bullen
Microsoft MVP - Excel

Professional Excel Development
The most advanced Excel VBA book available
www.oaltd.co.uk/ProExcelDev



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Can this be done ?

Ok, I found the SetBKColor function in the 'gdi32' Library and the code works
great apart from one problem :The colouring of the Formula bar is
inconsistent ie : it keeps coming and going .

Also, how do I set the Formula colour back to its default ?

Great stuff Stephen and thanks very much :)

Jaafar.


"RAFAAJ2000" wrote:

Thanks Stephen ,

Is the 'SetBKColor' a UDF ? if so, it is not defined in your code !
If it is an API Function why can't I find it on the API functions list ?!!

Thanks again.

Jaafar.


"Stephen Bullen" wrote:

Hi Rafaaj2000,

Can the background's colour of the Excel Formula Bar be set ?

Unlike other objects in the Excel object model, the formula bar exposes a
window handle and a Class name "EXCEL;" so I thought maybe changing its
background colour could probably be achieved via some API calls .(
SendMessage or....)


Sure, something like:

hWnd = FindWindowEx(Application.hWnd,0,"EXCEL<",vbnullstr ing)
hDC = GetDC(hWnd)
SetBkColor hDC, &h0000FF
ReleaseDC hWnd,hDC

N.B. "EXCEL<" is the class name of the edit box bit of the formula bar.

Regards

Stephen Bullen
Microsoft MVP - Excel

Professional Excel Development
The most advanced Excel VBA book available
www.oaltd.co.uk/ProExcelDev



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Can this be done ?

Hi Rafaaj2000,

Ok, I found the SetBKColor function in the 'gdi32' Library and the code works
great apart from one problem :The colouring of the Formula bar is
inconsistent ie : it keeps coming and going .


Yeah, I guess Excel is setting some colouring when you edit a formula

Also, how do I set the Formula colour back to its default ?


call it again, setting a backcolour of &HFFFFFF?

Regards

Stephen Bullen
Microsoft MVP - Excel

Professional Excel Development
The most advanced Excel VBA book available
www.oaltd.co.uk/ProExcelDev


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 02:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"