msfz751

IPM automation VBA for Prosper model files

Oct 1st, 2013
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' ====================================================================
  2. ' IPM Openserver Prosper VBA - by Alfonso R. Reyes
  3. ' This subroutine opens a Prosper file and reads the commands on
  4. ' the table. It will return the values for each command.
  5. ' Additionally, returns the string name of few correlations
  6. ' =====================================================================
  7. Sub ReadFile()
  8. Dim i, j As Integer
  9. Connect
  10. For i = startRow To curRow - 1                  '<-travel the rows
  11.    Select Case MyApplication
  12.         Case "Prosper"
  13.             cmdOpen = "PROSPER.OPENFILE(""" + Cells(i, startCol) + """)"
  14.             DoCmdNoStop "" + cmdOpen + ""
  15.             For j = startCmdCol To endCmdCol    '<-travel the columns
  16.                Cells(i, j) = DoGetNoStop(Cells(IPMCommandsRow, j))
  17.                 Application.StatusBar = "File:" & Cells(i, startCol + 1) _
  18.                     & ", Row:" & i & "/" & (curRow - 1) _
  19.                     & " Col:" & j & "/" & endCmdCol & ", Cmd: " _
  20.                     & Cells(IPMCommandsRow, j) & ", Val: " _
  21.                     & Left(Cells(i, j), 25)   'show all this in status bar
  22.            Next
  23.             ' now convert the corrrelation number to its human value
  24.            Cells(i, corr1NameCol) = PBCORR(Cells(i, corr1NumCol))
  25.             Cells(i, corr2NameCol) = UOCORR(Cells(i, corr2NumCol))
  26.             Cells(i, corr3NameCol) = IPRMETHOD(Cells(i, corr3NumCol))
  27.             Cells(i, corr4NameCol) = VLPTUBING(Cells(i, corr4NumCol))
  28.         Case "MBAL"
  29.             DoCmdNoStop "MBAL.OPENFILE(""" + Cells(3, 6) + """)"
  30.         Case "GAP"
  31.             DoCmdNoStop "GAP.OPENFILE(""" + Cells(3, 6) + """)"
  32.     End Select
  33. Next
  34. Disconnect
  35. End Sub
Advertisement
Add Comment
Please, Sign In to add comment