Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Problem when Excel Not Maximized

Okay guys, this is a weird one.

I'm running the sample code below from Access to dump data to a worksheet,
which works fine except for one thing.

If Excel is already open when my code runs AND is minimized, the following
happens:

1. Access gives focus to Excel and
2. Excel pops up (gets the focus), but does not maximize

I do not want Excel to have focus until all of my code runs and I want it to
show maximized. Interestingly, this does not happen if Excel is maximized
already (like when Alt-Tabbing to different open applications). It also does
not happen if Excel is NOT open when my code runs.

The main reason this is an issue is because I am using the status bar in
Access to let my users know the progress of the procedure and I don't want
them to see the worksheet as it is being populated.

I am using objXL.Visible = True at the end of my code, but this doesn't make
any difference. The code below is just a small portion of code in my
procedure, but seems to be where my issue is.

Any help with this would be appreciated.


SAMPLE CODE:


'Open workbook and Excel, if needed.

If fIsAppRunning("Excel") Then
Set objXL = GetObject(, "Excel.Application")
boolXL = False
Else
Set objXL = CreateObject("Excel.Application")
boolXL = True
End If

'Set source file and path.

FileName = DLookup("[TemplateFile]", "tblPaths", "[Process] = 'Daily Sum
Report'")

PathName = DLookup("[Path]", "tblPaths", "[Process] = 'Daily Sum Report'")

'Set Excel workbook.

Set objActiveWkb = objXL.Workbooks.Open(PathName & FileName)

Set objActiveWkb = objXL.Application.ActiveWorkbook


Thanks,
Clint
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Problem when Excel Not Maximized

You could use an API's first to get the window handle then set it to
foreground but try
AppActivate Application.Caption

Regards,
Peter T

"cherman" wrote in message
...
Okay guys, this is a weird one.

I'm running the sample code below from Access to dump data to a worksheet,
which works fine except for one thing.

If Excel is already open when my code runs AND is minimized, the following
happens:

1. Access gives focus to Excel and
2. Excel pops up (gets the focus), but does not maximize

I do not want Excel to have focus until all of my code runs and I want it

to
show maximized. Interestingly, this does not happen if Excel is maximized
already (like when Alt-Tabbing to different open applications). It also

does
not happen if Excel is NOT open when my code runs.

The main reason this is an issue is because I am using the status bar in
Access to let my users know the progress of the procedure and I don't want
them to see the worksheet as it is being populated.

I am using objXL.Visible = True at the end of my code, but this doesn't

make
any difference. The code below is just a small portion of code in my
procedure, but seems to be where my issue is.

Any help with this would be appreciated.


SAMPLE CODE:


'Open workbook and Excel, if needed.

If fIsAppRunning("Excel") Then
Set objXL = GetObject(, "Excel.Application")
boolXL = False
Else
Set objXL = CreateObject("Excel.Application")
boolXL = True
End If

'Set source file and path.

FileName = DLookup("[TemplateFile]", "tblPaths", "[Process] = 'Daily

Sum
Report'")

PathName = DLookup("[Path]", "tblPaths", "[Process] = 'Daily Sum

Report'")

'Set Excel workbook.

Set objActiveWkb = objXL.Workbooks.Open(PathName & FileName)

Set objActiveWkb = objXL.Application.ActiveWorkbook


Thanks,
Clint



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Problem when Excel Not Maximized

Thanks for the tip! I will try it out.

Clint

"Peter T" wrote:

You could use an API's first to get the window handle then set it to
foreground but try
AppActivate Application.Caption

Regards,
Peter T

"cherman" wrote in message
...
Okay guys, this is a weird one.

I'm running the sample code below from Access to dump data to a worksheet,
which works fine except for one thing.

If Excel is already open when my code runs AND is minimized, the following
happens:

1. Access gives focus to Excel and
2. Excel pops up (gets the focus), but does not maximize

I do not want Excel to have focus until all of my code runs and I want it

to
show maximized. Interestingly, this does not happen if Excel is maximized
already (like when Alt-Tabbing to different open applications). It also

does
not happen if Excel is NOT open when my code runs.

The main reason this is an issue is because I am using the status bar in
Access to let my users know the progress of the procedure and I don't want
them to see the worksheet as it is being populated.

I am using objXL.Visible = True at the end of my code, but this doesn't

make
any difference. The code below is just a small portion of code in my
procedure, but seems to be where my issue is.

Any help with this would be appreciated.


SAMPLE CODE:


'Open workbook and Excel, if needed.

If fIsAppRunning("Excel") Then
Set objXL = GetObject(, "Excel.Application")
boolXL = False
Else
Set objXL = CreateObject("Excel.Application")
boolXL = True
End If

'Set source file and path.

FileName = DLookup("[TemplateFile]", "tblPaths", "[Process] = 'Daily

Sum
Report'")

PathName = DLookup("[Path]", "tblPaths", "[Process] = 'Daily Sum

Report'")

'Set Excel workbook.

Set objActiveWkb = objXL.Workbooks.Open(PathName & FileName)

Set objActiveWkb = objXL.Application.ActiveWorkbook


Thanks,
Clint




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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2010 not opening in maximized view racee Excel Discussion (Misc queries) 1 May 28th 10 05:39 PM
I want Word & Excel to open maximized. highbloodpressure Excel Discussion (Misc queries) 1 November 7th 08 08:29 PM
I want to launch Excel 2007 in Maximized state every time Karen B Excel Discussion (Misc queries) 1 August 6th 08 04:24 PM
Excel window not maximized on start Hennie Excel Discussion (Misc queries) 1 July 25th 05 05:16 PM
How do I get excel to always open with a maximized window Stacymm Excel Discussion (Misc queries) 1 February 10th 05 10:07 PM


All times are GMT +1. The time now is 11:34 PM.

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

About Us

"It's about Microsoft Excel"