Guest User

Untitled

a guest
Mar 17th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. objExcel = System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application")
  2.  
  3. Set wsh = VBA.CreateObject("WScript.Shell")
  4. arg = ActiveWorkbook.Path & ";" & ActiveWorkbook.Name & ";" & ActiveSheet.Name & ";" & Target.Address
  5. ' Wait for the shelled application to finish:
  6. errorCode = wsh.Run(strPathDatePicker & " " & arg, windowStyle, waitOnReturn)
  7.  
  8. Public Sub frmDatePicker_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  9. Dim Par() As String
  10. Dim strTemp As String
  11.  
  12. Try
  13. Dim arg = Environment.GetCommandLineArgs
  14. strTemp = arg(1)
  15. Par = Split(strTemp, ";")
  16.  
  17. 'Split arg, to get the Information from the Excel Workbook
  18. strWbPath = Par(0)
  19. strWbName = Par(1)
  20. strWsName = Par(2)
  21. strAdresse = Par(3)
  22.  
  23. Catch ex As Exception
  24. Me.Close()
  25. End Try
  26. End Sub
  27.  
  28. Private Sub MonthCalendar1_DateSelected(sender As Object, e As DateRangeEventArgs) Handles MonthCalendar1.DateSelected
  29. Dim objExcel As Excel.Application
  30. Dim wb As Excel.Workbook
  31. Dim ws As Excel.Worksheet
  32.  
  33. Try
  34. 'Get the Excel Object
  35. objExcel = System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application")
  36.  
  37.  
  38. For Each wb In objExcel.Workbooks
  39. If wb.Name = strWbName Then
  40. ws = wb.Sheets(strWsName)
  41. ws.Range(strAdresse.ToString).Value = e.Start()
  42. Me.Close()
  43. End If
  44.  
  45. Next
  46. Catch ex As Exception
  47. MessageBox.Show(ex.Message)
  48. Me.Close()
  49. End Try
  50.  
  51. End Sub
  52.  
  53. Dim o As Object = GetObject("Book 1.xls")
  54. Dim wb As Excel.Workbook = TryCast(o, Excel.Workbook)
  55.  
  56. arg = ActiveWorkbook.Path & ";" & ActiveWorkbook.Name & ";" & ActiveSheet.Name & ";" & Target.Address
  57.  
  58. arg = ThisWorkbook.Path & ";" & ThisWorkbook.Name & ";" & ActiveSheet.Name & ";" & Target.Address
Add Comment
Please, Sign In to add comment