Right after World War II, when industry powered up in peacetime and started cranking out consumer goods, emissions increased rapidly for both CO2 and particles from smokestacks. If emissions are suddenly ramped up like that, and then held constant, the number of sun-blocking particles in the air increases for a week or so and then stabilizes, because particles are falling out of the air as rapidly as they are added. But, for a given rate of emission, the CO2 concentration of the air will rise for a few hundred thousand years, until the rate of rock weathering balances the new, raised rate of emission. (Human emissions did not remain constant, but this may help you think about things.) For industry after the war, the particles emitted in the first week had a cooling effect that was much larger than the warming effect of the CO2 emitted during that week. But, as years became decades, the particles fell down, much of the CO2 stayed up, and the warming grew to outweigh the cooling.
Volcanic eruptions have essentially the same story. Over short times, the sun-blocking cooling from particles exceeds the warming of the CO2. The volcanic particles typically get thrown into the stratosphere, above most rainfall, and so stay up a year or two rather than a week or so, but then fall out. So if extra volcanism continues long enough, the particles fall down, the CO2 builds up, and warming results. Exactly how long you have to wait for “short time” to become “long time” depends on the types of volcanoes and many other issues. In general, an increase in volcanic activity (typically involving many volcanoes, or huge volcanic provinces) will cause cooling over times of years to centuries that most economists worry about, but with warming over longer, geologic time.