PC Review


Reply
Thread Tools Rate Thread

What does a File open like this Q

 
 
Sean
Guest
Posts: n/a
 
      17th Oct 2007
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

 
Reply With Quote
 
 
 
 
Doug Glancy
Guest
Posts: n/a
 
      17th Oct 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
>


 
Reply With Quote
 
Sean
Guest
Posts: n/a
 
      17th Oct 2007
Of course! Thanks Doug




 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
in vb.net how to open a file from file download prompt without askinguser to save it or run it....just open it in internet explorer Kaustubh Budukh Microsoft Dot NET 4 23rd Jun 2008 10:10 PM
Can I view the full file name on the File/Open list before I open Eric Microsoft Word Document Management 0 29th Nov 2007 01:48 AM
Help - My file/open, file/save etc file dialogs open in no order whatsoever ? Ian Turner Microsoft Windows 2000 File System 1 27th Feb 2004 08:33 PM
Open file, save file, file now 120K smaller and crashes upon open Chris Microsoft Excel Crashes 1 8th Nov 2003 12:56 AM
double click doesn't open the file// instead file->open->...the file open norma nks Microsoft Word New Users 1 3rd Oct 2003 03:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:03 AM.