PDA

Click to See Complete Forum and Search --> : Viso and Excel Spreadsheet


office_xp
Mar 19th, 2006, 11:36 PM
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,




Sub DrawJobs(p_org_code As Long)
Dim shpChild As Visio.Shape
Dim increment As Double
Dim j As Integer
Dim subNO As Double
Dim start_of_job_index As Integer
Dim xPos As Double, yPos As Double
Dim i As Integer

j = 1
Set pagObj_job = pagsObj.Item(2)
While (organization_jobs(j).code <> p_org_code And j < no_of_records)
j = j + 1
Wend

If organization_jobs(j).code = p_org_code Then
start_of_job_index = j
Else
Exit Sub
End If

i = start_of_job_index

'For i = 1 To no_of_records
box_height = 0.8
Set shpChild = pagObj_job.Drop(mastObj, job_xPos, job_yPos)
job_box = job_box + 1
'yPos = yPos 'job shape width
job_xPos = job_xPos + 3
' MyFont.Bold = True
shpChild.Text = organization_jobs(i).title & " ( " & organization_jobs(i).code & " ) " & Chr(10)
'MyFont.Bold = False
Do
'shpChild.Text = shpChild.Text & Chr(10) & organization_jobs(i).sap_job_code & " | " & organization_jobs(i).suffex & " | "
shpChild.Text = shpChild.Text & Chr(10) & organization_jobs(i).sap_job_code & " " & organization_jobs(i).suffex & " "
If organization_jobs(i).grade_code >= 15 Then
' shpChild.Text = shpChild.Text & " | EP | "
shpChild.Text = shpChild.Text & " EP "
Else
'shpChild.Text = shpChild.Text & " | "
shpChild.Text = shpChild.Text & " "
shpChild.Text = shpChild.Text & organization_jobs(i).grade_code & " "
'shpChild.Text = shpChild.Text & organization_jobs(i).grade_code & " | "
End If



'shpChild.Text = shpChild.Text & organization_jobs(i).Incumbent & " | "
shpChild.Text = shpChild.Text & organization_jobs(i).job_title

'& organization_jobs(i).grade_code & " | " & organization_jobs(i).job_title & " | " & organization(i).Incumbent
i = i + 1
box_height = box_height + 0.1
shpChild.Cells("Para.HorzAlign").Formula = 0
Loop While organization_jobs(i).code = p_org_code
' draw box in the next line
If job_box Mod 4 = 0 Then
job_yPos = job_yPos - 4
job_xPos = 2
End If
j = j + 1
i = i - 1
shpChild.Cells("Height").Formula = box_height
shpChild.Cells("Width").Formula = 2.5
shpChild.Cells("Char.Size").Formula = "= " & 7 & " pt."
'Next




End Sub