Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default What does a File open like this Q

I have a file that when opened (I normally open via Windows Explorer)
reverts the screen via back to Windows Explorer. Why is that?

I have tried to place the Sheet name within the code that I want it to
start the view from (front Page), but it makes no difference



Option Explicit
Sub Auto_Open()

Application.ScreenUpdating = False
Application.WindowState = xlMinimized

Dim OLKApp As Outlook.Application
Dim WeStartedIt As Boolean


On Error Resume Next
Set OLKApp = GetObject(, "Outlook.Application")
On Error GoTo 0
If OLKApp Is Nothing Then
Set OLKApp = CreateObject("Outlook.Application")
If OLKApp Is Nothing Then
' can't create app
' error mesage then exit
MsgBox "Can't Get Outlook"
Exit Sub
End If
WeStartedIt = True
Else
WeStartedIt = False
End If

Sheets("Front Page").Activate
Range("A1").Select


Dim OkToCallMacro As Boolean
OkToCallMacro = False
Select Case Weekday(Date)
Case vbMonday To vbFriday
If Time = TimeSerial(8, 44, 0) _
And Time < TimeSerial(8, 46, 0) Then
OkToCallMacro = True
End If
Case Is = vbSaturday, vbSunday
If Time = TimeSerial(8, 44, 0) _
And Time < TimeSerial(8, 46, 0) Then
OkToCallMacro = True
End If
End Select

If OkToCallMacro Then
Call Copy_Paste

If Workbooks.Count = 1 Then
'only this workbook is open
ThisWorkbook.Save
'close the application
'(which will close thisworkbook)
Application.Quit
Else
ThisWorkbook.Close savechanges:=True
End If
End If

If WeStartedIt = True Then
OLKApp.Quit

End If
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default What does a File open like this Q

Sean,

Your second line:

Application.WindowState = xlMinimized

means that Excel is minimized. This means that you see Windows Explorer,
since it was the last program you were in.

hth,

Doug

"Sean" wrote in message
ps.com...
I have a file that when opened (I normally open via Windows Explorer)
reverts the screen via back to Windows Explorer. Why is that?

I have tried to place the Sheet name within the code that I want it to
start the view from (front Page), but it makes no difference



Option Explicit
Sub Auto_Open()

Application.ScreenUpdating = False
Application.WindowState = xlMinimized

Dim OLKApp As Outlook.Application
Dim WeStartedIt As Boolean


On Error Resume Next
Set OLKApp = GetObject(, "Outlook.Application")
On Error GoTo 0
If OLKApp Is Nothing Then
Set OLKApp = CreateObject("Outlook.Application")
If OLKApp Is Nothing Then
' can't create app
' error mesage then exit
MsgBox "Can't Get Outlook"
Exit Sub
End If
WeStartedIt = True
Else
WeStartedIt = False
End If

Sheets("Front Page").Activate
Range("A1").Select


Dim OkToCallMacro As Boolean
OkToCallMacro = False
Select Case Weekday(Date)
Case vbMonday To vbFriday
If Time = TimeSerial(8, 44, 0) _
And Time < TimeSerial(8, 46, 0) Then
OkToCallMacro = True
End If
Case Is = vbSaturday, vbSunday
If Time = TimeSerial(8, 44, 0) _
And Time < TimeSerial(8, 46, 0) Then
OkToCallMacro = True
End If
End Select

If OkToCallMacro Then
Call Copy_Paste

If Workbooks.Count = 1 Then
'only this workbook is open
ThisWorkbook.Save
'close the application
'(which will close thisworkbook)
Application.Quit
Else
ThisWorkbook.Close savechanges:=True
End If
End If

If WeStartedIt = True Then
OLKApp.Quit

End If
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default What does a File open like this Q

Of course! Thanks Doug




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
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Excel Discussion (Misc queries) 0 April 23rd 09 08:53 PM
In Excel - Use Windows Explorer instead of File Open to open file KymY Excel Discussion (Misc queries) 1 August 5th 06 09:59 PM
Open a file do a macro ( made) and open next succesive file SVTman74 Excel Programming 5 April 21st 06 10:14 PM
Open File or Switch Between Windows if File is Open Ricky Pang Excel Programming 2 July 8th 05 05:51 AM
Open File or Switch Between Windows if File is Open Ricky Pang Excel Programming 0 July 2nd 05 08:41 PM


All times are GMT +1. The time now is 02:32 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"