Measure the width of your doorway using the tape measure and compare this to the length of a single molding piece. Your molding pieces will be supplied in single lengths. If the opening is larger than the length of a single piece, measure two lengths, each half the length of the doorway.
Mark the length of the doorway on the underside of the molding strip, leaving an additional 3 to 5 millimeters as an error margin. Measure too long and you can sand the molding down to create a snug fit. Cut it too short and you'll be left with an unsightly gap.
Cut across the mark on the molding piece and slot it into the space in the doorway. Position it so the square-ended tab fits in the void between the wood flooring and the carpeted area. Ensure the length is correct, and sand down the rough ends of the molding to create a snug fit in the frame.
Lift the molding piece out once you're sure that it fits correctly. Pipe a sparing amount of adhesive caulk into the void, then replace the molding piece and press it down firmly. Wipe away any adhesive that is squeezed out of the edges of the molding piece. Allow it to set overnight.