Usually a short time. Constipation from opiates usually resolves in a week or two; in fact, often in withdrawal, especially cold turkey, there is diarrhea for a while instead. I would recommend taking a stool softener twice daily (colace (docusate sodium) or surfak), making sure you have lots of fiber in your diet. If it persists for more than 2 weeks, see your doctor. Also, get some support for your addiction in na or aa or elsewhere.
Bowel Mechanics. It depends on how long you've taken the vicodin. Usually after short term use up to 10 days, the effects wear off rather quickly after you stop taking the medication. Longer, chronic use can significantly impair motility of the gut, so it is possible the problem could persist for an extended period of time but usually a stimulant laxative can help. Avoid stimulant laxatives while on narcotics.