LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default My Workbook is always hidden when I open it?

I don't know what I've done to it. I have on open and before save events, but
I can't see the problem. I want the document to open visible.

Can you have a look and tell me if there's something I'm missing?

Private Sub Workbook_Open()
Dim wbk1 As Workbook
Dim wbk2 As Workbook

On Error Resume Next
Set wbk1 = Workbooks("Export_Requests.csv")
Set wbk2 = Workbooks("Project Summary.xls")

If wbk1 Is Nothing Then
ChDir "I:\A&T Contracts\000 Utilities\"
Set wbk1 = Workbooks.Open("I:\A&T Contracts\000 Utilities\Project
Specific\Contract Docs\Integrated Utility Services\Export_Requests.csv")
ActiveWindow.Visible = False
End If

If wbk2 Is Nothing Then
ChDir "I:\A&T Contracts\000 Utilities\Project Specific\Contract
Docs\Integrated Utility Services\Option E\Payment\"
Set wbk4 = Workbooks.Open("I:\A&T Contracts\000 Utilities\Project
Specific\Contract Docs\Integrated Utility Services\Option E\Payment\Project
Summary.xls")
ActiveWindow.Visible = False
End If

End Sub

'*******

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim i As Integer
Dim sPath As String
Dim sFilename As String

Application.ScreenUpdating = False

Range("A1").Select

'Backup to Flashdrive
msg = "Do you want to save a Backup to your Flashdrive?"
Style = vbYesNo + vbInformation + vbDefaultButton2

Response = MsgBox(msg, Style)
If Response = vbYes Then

On Error Resume Next


Set fs = CreateObject("Scripting.FileSystemObject")
For i = 67 To 90
Set drspec = fs.GetDrive(Chr(i))
If drspec.drivetype = 1 Then
'MsgBox "Drive " & Chr(i) & " is the removable drive"
sPath = Chr(i) & ":\Work\Solutions Folder\IUS MONITOR\"
sFilename = "IUS Monitor " & _
Format(DateSerial(Year(Date), Month(Date), _
Day(Date)), "dd MM yy") & ".xls"

ans = MsgBox("Save File as " & sFilename & "?")
If ans = vbOK Then

'Check Path exists
If CreateObject("Scripting.FileSystemobject") _
.folderexists(sPath) = False Then
MkDir sPath
End If

ActiveWorkbook.SaveCopyAs sPath & sFilename
End If
i = 90
End If
Next i

Else
ActiveWorkbook.Activate
End If

Application.ScreenUpdating = True
End Sub

'Thanks
'Dylan

 
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
Open Second Workbook Hidden? Nancy Taylor[_2_] Excel Worksheet Functions 2 September 21st 09 05:46 PM
Workbook Open but not visible (and not HIDDEN?!?) mcleester Excel Discussion (Misc queries) 0 December 30th 08 03:02 PM
Open a specific workbook...find value from other open workbook and then insert cells values in cell next to it. [email protected] Excel Programming 1 May 13th 07 01:46 PM
open external workbook keep hidden cereldine[_8_] Excel Programming 1 April 10th 06 12:28 PM
How to hide a workbook and to detect a hidden workbook in visual basic jn1971[_3_] Excel Programming 0 May 5th 04 10:08 PM


All times are GMT +1. The time now is 09:55 AM.

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"