Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim objexcel As Excel.Application
- Dim wbexcel As Excel.Workbook
- Dim wbExists As Boolean
- Set objexcel = CreateObject("excel.Application")
- objexcel.Visible = True
- On Error GoTo Openwb
- wbExists = False
- Set wbexcel = objexcel.Documents.Open("C:Documents and SettingsTAYYAPPDesktoptest folderERROR REPORT2.xls")
- wbExists = True
- Openwb:
- On Error GoTo 0
- If Not wbExists Then
- Set wbexcel = objexcel.Workbook.Add
- End If
- Set wbexcel = objexcel.Workbook.Add
- Set wbexcel = objexcel.WorkBooks.Open( _
- "C:Documents and SettingsTAYYAPPDesktoptest folderERROR REPORT2.xls")
- objexcel.Workbooks.Add
- Set wbexcel = objexcel.ActiveWorkbook
- Dim objexcel As Excel.Application
- Dim wbexcel As Excel.Workbook
- Dim wbExists As Boolean
- Dim objSht As Excel.Worksheet
- Dim objRange As Excel.Range
- Set objexcel = CreateObject("excel.Application")
- objexcel.Visible = True
- On Error GoTo Openwb
- wbExists = False
- Set wbexcel = objexcel.Workbooks.Open("C:Documents and SettingsTAYYAPPDesktoptest folderreportsERROR REPORT2.xls")
- Set objSht = wbexcel.Worksheets("Sheet1")
- objSht.Activate
- wbExists = True
- Openwb:
- On Error GoTo 0
- If Not wbExists Then
- objexcel.Workbooks.Add
- Set wbexcel = objexcel.ActiveWorkbook
- Set objSht = wbexcel.Worksheets("Sheet1")
- End If
Add Comment
Please, Sign In to add comment