Guest User

Untitled

a guest
Nov 23rd, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. '----------------------------------------------
  2. ' Macro to use runSHUTTLE addin with code
  3. '----------------------------------------------
  4. Sub RunSHUTTLEfile()
  5. '
  6. ' RunSHUTTLEfile Macro
  7. '
  8. Dim runSHUTTLEAddin, AddinObject
  9.  
  10. On Error GoTo ErrHandler
  11. ' GET ADDIN OBJECT FROM EXCEL
  12. Set runSHUTTLEAddin = Application.COMAddIns.Item("TxRunner.AddinModule")
  13.  
  14. If runSHUTTLEAddin Is Nothing Then
  15. MsgBox "Unable to initialize object of runSHUTTLE addin"
  16. Exit Sub
  17. End If
  18.  
  19. ' Get com object from addin object
  20. Set AddinObject = runSHUTTLEAddin.Object.TsMacros
  21. If runSHUTTLEAddin Is Nothing Then
  22. MsgBox "Unable to initialize com object of runSHUTTLE addin"
  23. Exit Sub
  24. End If
  25.  
  26. ' Set the type of run from the following
  27. ' RunNow = 0,
  28. ' RunOnErrors = 1,
  29. ' StepByStep_StopOnAllScreens = 2,
  30. ' StepByStep_StopOnErrors = 3
  31. AddinObject.TypeofRun = 0
  32.  
  33. ' Set the Run On Rows from the following
  34. ' AsInShuttleFile = 0, // rows as in SHUTTLE file
  35. ' Selected = 1, // selected rows on active excel sheet
  36. ' Filtered = 2 // filtered rows on active excel sheet
  37. AddinObject.RunOnRows = 1
  38.  
  39. Dim strShuttleFile As String
  40.  
  41. ' open existing SHUTTLEfile to Run
  42. strShuttleFile = "C:Users310274697DocumentsWinShuttleTRANSACTIONTRANSACTION scriptsCreation of Materials Scripts2017.11.21 ZMM01U creation of materials BR9V.txr"
  43. AddinObject.OpenShuttleFile (strShuttleFile)
  44.  
  45. AddinObject.StartRow = 2
  46.  
  47. AddinObject.EndRow = 3
  48.  
  49. AddinObject.LogColumn = "E"
  50.  
  51. 'Change ALF path as per requirement and accessibility of file.
  52. 'Change Sheet where data can be written
  53. 'AddinObject.SheetName = "Sheet3"
  54. 'AddinObject.AlfPath = "C:USERSSASINGHDOCUMENTSWINSHUTTLETRANSACTIONALFWE6800_ANKUR.ALF"
  55. 'AddinObject.ResultFileName = "C:UsersSASINGHDocumentsWinshuttleTRANSACTIONDataCopy of Abs-ldcvb.xlsx"
  56.  
  57. ' Call the Run Function to start uploading data
  58. AddinObject.Run
  59. Exit Sub
Add Comment
Please, Sign In to add comment