Hi all,

I am doing SAP/ABAP. I an new to VB. I am working on a task to allow Visio to read Comma seaparated file and populate the boxes in the Visio accordingly. one of my collegues wrote the macro to do so, and then he left the company. now i need to inhanced the macro to do the following:

  • Make the populated bxes as Excel sheet instead of normal visio shape. the reason is that the box consist of many colums and need sometimes to be increased.


if any one can help me and update the VB code to satisfy this, i will be more than thankful for him,

as i guss is the logic is as follows: dynamicaly create the sheets in visio based on the coma seaparetd file, then populate the date in each sheet accordingly.

waiting for a replay,

VB Code:
  1. Sub DrawJobs(p_org_code As Long)
  2. Dim shpChild As Visio.Shape
  3. Dim increment As Double
  4. Dim j As Integer
  5. Dim subNO As Double
  6. Dim start_of_job_index As Integer
  7. Dim xPos As Double, yPos As Double
  8. Dim i As Integer
  9.  
  10.             j = 1
  11.             Set pagObj_job = pagsObj.Item(2)
  12.         While (organization_jobs(j).code <> p_org_code And j < no_of_records)
  13.         j = j + 1
  14.         Wend
  15.        
  16.        If organization_jobs(j).code = p_org_code Then
  17.           start_of_job_index = j
  18.        Else
  19.        Exit Sub
  20.        End If
  21.            
  22.            i = start_of_job_index
  23.            
  24.            'For i = 1 To no_of_records
  25.              box_height = 0.8
  26.             Set shpChild = pagObj_job.Drop(mastObj, job_xPos, job_yPos)
  27.             job_box = job_box + 1
  28.             'yPos = yPos  'job shape width
  29.              job_xPos = job_xPos + 3
  30.             ' MyFont.Bold = True
  31.              shpChild.Text = organization_jobs(i).title & " ( " & organization_jobs(i).code & " ) " & Chr(10)
  32.              'MyFont.Bold = False
  33.              Do
  34.              'shpChild.Text = shpChild.Text & Chr(10) & organization_jobs(i).sap_job_code & " |  " & organization_jobs(i).suffex & "  | "
  35.               shpChild.Text = shpChild.Text & Chr(10) & organization_jobs(i).sap_job_code & "   " & organization_jobs(i).suffex & "   "
  36.              If organization_jobs(i).grade_code >= 15 Then
  37.            '  shpChild.Text = shpChild.Text & " |  EP | "
  38.               shpChild.Text = shpChild.Text & "   EP  "
  39.              Else
  40.              'shpChild.Text = shpChild.Text & " | "
  41.              shpChild.Text = shpChild.Text & "  "
  42.              shpChild.Text = shpChild.Text & organization_jobs(i).grade_code & "  "
  43.              'shpChild.Text = shpChild.Text & organization_jobs(i).grade_code & " | "
  44.              End If
  45.              
  46.              
  47.              
  48.             'shpChild.Text = shpChild.Text & organization_jobs(i).Incumbent & " | "
  49.             shpChild.Text = shpChild.Text & organization_jobs(i).job_title
  50.            
  51.         '& organization_jobs(i).grade_code & " | " & organization_jobs(i).job_title & " | " & organization(i).Incumbent
  52.              i = i + 1
  53.              box_height = box_height + 0.1
  54.              shpChild.Cells("Para.HorzAlign").Formula = 0
  55.             Loop While organization_jobs(i).code = p_org_code
  56. ' draw box in the next line
  57.             If job_box Mod 4 = 0 Then
  58.                 job_yPos = job_yPos - 4
  59.                 job_xPos = 2
  60.              End If
  61.             j = j + 1
  62.             i = i - 1
  63.             shpChild.Cells("Height").Formula = box_height
  64.             shpChild.Cells("Width").Formula = 2.5
  65.             shpChild.Cells("Char.Size").Formula = "= " & 7 & " pt."
  66.          'Next
  67.  
  68.  
  69.  
  70.  
  71. End Sub