Catafratto
Guest
if you explain the problem more clearly and describe the solution adopted for the parties.


Hello, catafract,Try this on something not vital to you, I think it works but you can never say.
it's not ilogic, it's vba: if you're looking in the forum find how and where to copy everything, it's been written a few times nowCode:' aggiorna i numeri progressivi public sub updateprogressivo() dim oapp as application set oapp = thisapplication dim odoc as document set odoc = oapp.activeeditdocument dim spn as string spn = readpartnumber(odoc) dim scode as string dim orefdocs as variant dim orefdoc as document call codecreator(odoc) ' si collega ai documenti usati nell'assieme set orefdocs = odoc.allreferenceddocuments ' aggiorna tutti i documenti collegati if orefdocs.count > 0 then for each orefdoc in orefdocs call codecreator(orefdoc) next end if end sub private sub codecreator(odoc as document) dim spn as string spn = readpartnumber(odoc) dim scode as string ' se il numero parte è più lungo di due caratteri ' prende gli ultimi due caratteri e li copia nella ipropery personalizzata if strings.len(spn) > 2 then scode = strings.right(spn, 2) else scode = "" end if call writecustomproperties(odoc, "progressivo", scode) end sub private function readpartnumber(odoc as document) as string 'definisce vari set di proprietà: --------------------------------------------------------------------- dim opropsets as propertysets set opropsets = odoc.propertysets 'design tracking proprieties dim odesigntrackingproprieties as propertyset set odesigntrackingproprieties = opropsets.item("{32853f0f-3444-11d1-9e93-0060b03c1ca6}") readpartnumber = odesigntrackingproprieties.itembypropid(kpartnumberdesigntrackingproperties).value end function private sub writecustomproperties(odoc as document, spropid as string, spropvalue as string) dim ocustompropset as propertyset set ocustompropset = odoc.propertysets.item("{d5cdd505-2e9c-101b-9397-08002b2cf9ae}") dim bpropexist as boolean bpropexist = false dim oprop as property dim ocustomprop as property for each oprop in ocustompropset if oprop.name = spropid then bpropexist = true set ocustomprop = oprop exit for end if next if bpropexist = false then call ocustompropset.add(spropvalue, spropid) else ocustomprop.value = spropvalue end if end sub
Hello, catafract,Try this on something not vital to you, I think it works but you can never say.
it's not ilogic, it's vba: if you're looking in the forum find how and where to copy everything, it's been written a few times nowCode:' aggiorna i numeri progressivi public sub updateprogressivo() dim oapp as application set oapp = thisapplication dim odoc as document set odoc = oapp.activeeditdocument dim spn as string spn = readpartnumber(odoc) dim scode as string dim orefdocs as variant dim orefdoc as document call codecreator(odoc) ' si collega ai documenti usati nell'assieme set orefdocs = odoc.allreferenceddocuments ' aggiorna tutti i documenti collegati if orefdocs.count > 0 then for each orefdoc in orefdocs call codecreator(orefdoc) next end if end sub private sub codecreator(odoc as document) dim spn as string spn = readpartnumber(odoc) dim scode as string ' se il numero parte è più lungo di due caratteri ' prende gli ultimi due caratteri e li copia nella ipropery personalizzata if strings.len(spn) > 2 then scode = strings.right(spn, 2) else scode = "" end if call writecustomproperties(odoc, "progressivo", scode) end sub private function readpartnumber(odoc as document) as string 'definisce vari set di proprietà: --------------------------------------------------------------------- dim opropsets as propertysets set opropsets = odoc.propertysets 'design tracking proprieties dim odesigntrackingproprieties as propertyset set odesigntrackingproprieties = opropsets.item("{32853f0f-3444-11d1-9e93-0060b03c1ca6}") readpartnumber = odesigntrackingproprieties.itembypropid(kpartnumberdesigntrackingproperties).value end function private sub writecustomproperties(odoc as document, spropid as string, spropvalue as string) dim ocustompropset as propertyset set ocustompropset = odoc.propertysets.item("{d5cdd505-2e9c-101b-9397-08002b2cf9ae}") dim bpropexist as boolean bpropexist = false dim oprop as property dim ocustomprop as property for each oprop in ocustompropset if oprop.name = spropid then bpropexist = true set ocustomprop = oprop exit for end if next if bpropexist = false then call ocustompropset.add(spropvalue, spropid) else ocustomprop.value = spropvalue end if end sub