Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Open Second Workbook Hidden? | Excel Worksheet Functions | |||
Workbook Open but not visible (and not HIDDEN?!?) | Excel Discussion (Misc queries) | |||
Open a specific workbook...find value from other open workbook and then insert cells values in cell next to it. | Excel Programming | |||
open external workbook keep hidden | Excel Programming | |||
How to hide a workbook and to detect a hidden workbook in visual basic | Excel Programming |