Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- Sub FileSplit()
- Dim Workbook
- Dim Worksheet
- Dim fileName
- Dim filePath
- Dim objExcel
- Dim objWorkbook
- Dim rowCount
- 'Application.ScreenUpdating = False
- 'Application.Calculation = xlCalculationManual
- MsgBox ("Hello World")
- filePath = locateFile()
- If filePath = "" Then
- MsgBox "Operation canceled", vbcritical
- Else
- wscript.echo filePath
- fileName = Mid(filePath, InStrRev(filePath, "") + 1)
- wscript.echo fileName
- End If
- Set objExcel = CreateObject("Excel.Application")
- objExcel.Visible = True
- Set objWorkbook = objExcel.Workbooks.Open(fileName)
- Set objWorkbook = Activeworkbook
- End Sub
- Function locateFile()
- locateFile = CreateObject("WScript.Shell").Exec( _
- "mshta.exe ""about:<input type=file id=f>" & _
- "<script>resizeTo(0,0);f.click();new ActiveXObject ('Scripting.FileSystemObject')" & _
- ".GetStandardStream(1).WriteLine(f.value);close();</script>""" _
- ).StdOut.ReadLine()
- End Function
- call FileSplit
Add Comment
Please, Sign In to add comment