daily pastebin goal
83%
SHARE
TWEET

Untitled

a guest Nov 9th, 2018 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Sub FileSplit()
  4.  
  5. Dim Workbook
  6. Dim Worksheet
  7. Dim fileName
  8. Dim filePath
  9. Dim objExcel
  10. Dim objWorkbook
  11. Dim rowCount
  12. 'Application.ScreenUpdating = False
  13. 'Application.Calculation = xlCalculationManual
  14. MsgBox ("Hello World")
  15. filePath = locateFile()
  16.  
  17.  
  18. If filePath = "" Then
  19.    MsgBox "Operation canceled", vbcritical
  20. Else
  21.    wscript.echo filePath
  22.    fileName = Mid(filePath, InStrRev(filePath, "") + 1)
  23.    wscript.echo fileName
  24. End If
  25.  
  26. Set objExcel = CreateObject("Excel.Application")  
  27.  
  28. objExcel.Visible = True  
  29.  
  30. Set objWorkbook = objExcel.Workbooks.Open(fileName)
  31. Set objWorkbook = Activeworkbook
  32.  
  33. End Sub
  34.  
  35.  
  36. Function locateFile()
  37.     locateFile = CreateObject("WScript.Shell").Exec( _
  38.     "mshta.exe ""about:<input type=file id=f>" & _
  39.     "<script>resizeTo(0,0);f.click();new ActiveXObject  ('Scripting.FileSystemObject')" & _
  40.  ".GetStandardStream(1).WriteLine(f.value);close();</script>""" _
  41.       ).StdOut.ReadLine()
  42.  
  43.  
  44. End Function
  45.  
  46.  
  47. call FileSplit
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand