PhilThomas
10-29-2004, 05:51 AM
Hi
I have to do some network patch panel layouts for engineers to fill in for us in word. Each site is different and has different kit. I would like to write a macro that would ask me for each document the following information.
1) How many rooms? Example answer 5
From this it would know to ask me for 5 sets of kit. 1 for each room.
2) How many ports in the room are utp and how many are fibre. This should calculate what kit is going into each room as we have set kit for certain numbers of ports.
Ideally this should then autogenerate a table for me for each room ala
[Title Bar] Room: Roomcode
[Row 1] Current patch | New Patch | Port
[Row 2] G1 | G1 | FastEthernet0/1/1
[Row 3] G2 | G4 | FatThernet0/1/2
where G1, G2 G4 would be filled in by the engineer, I have simply included them for clarity. The auto generated table would not include them.
Any ideas greatly appreciated. I thought of writing it in php but don't know how to pass this into a table in word with the correct syntax. I can't make it a html document as there is other stuff in there and they want it as word.
By this I mean I can create a table statically from a macro using
Sub Macro2()
'
' Macro2 Macro
'
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=48, NumColumns _
:=3
Selection.TypeText Text:="Port"
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="New Port"
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="Switchport"
Selection.MoveDown Unit:=wdLine, Count:=1
Do While Counter < 20 ' Inner loop.
Counter = Counter + 1 ' Increment Counter.
Selection.TypeText Text:="FastEthernet1/0/" & Counter
Selection.MoveDown Unit:=wdLine, Count:=1
Loop
End Sub
Its how I get the value of Counter in there and into other variables that is the problem. Is it possible to use a guided form to do this to collect all the information and then bung it to the macro? Of course this raises the question of how to pass values to the macro.
Thanks
Phil
I have to do some network patch panel layouts for engineers to fill in for us in word. Each site is different and has different kit. I would like to write a macro that would ask me for each document the following information.
1) How many rooms? Example answer 5
From this it would know to ask me for 5 sets of kit. 1 for each room.
2) How many ports in the room are utp and how many are fibre. This should calculate what kit is going into each room as we have set kit for certain numbers of ports.
Ideally this should then autogenerate a table for me for each room ala
[Title Bar] Room: Roomcode
[Row 1] Current patch | New Patch | Port
[Row 2] G1 | G1 | FastEthernet0/1/1
[Row 3] G2 | G4 | FatThernet0/1/2
where G1, G2 G4 would be filled in by the engineer, I have simply included them for clarity. The auto generated table would not include them.
Any ideas greatly appreciated. I thought of writing it in php but don't know how to pass this into a table in word with the correct syntax. I can't make it a html document as there is other stuff in there and they want it as word.
By this I mean I can create a table statically from a macro using
Sub Macro2()
'
' Macro2 Macro
'
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=48, NumColumns _
:=3
Selection.TypeText Text:="Port"
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="New Port"
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="Switchport"
Selection.MoveDown Unit:=wdLine, Count:=1
Do While Counter < 20 ' Inner loop.
Counter = Counter + 1 ' Increment Counter.
Selection.TypeText Text:="FastEthernet1/0/" & Counter
Selection.MoveDown Unit:=wdLine, Count:=1
Loop
End Sub
Its how I get the value of Counter in there and into other variables that is the problem. Is it possible to use a guided form to do this to collect all the information and then bung it to the macro? Of course this raises the question of how to pass values to the macro.
Thanks
Phil