For assessment of specific cardiac pathologies, vectorcardiography is generally considered superior with respect to electrocardiography. Existing vectorcardiography methods operate by calculating the vectorcardiogram (VCG) as a fixed linear combination of ECG signals. These methods, with the inverse Dower matrix method the current standard, are therefore not flexible with respect to different body compositions and geometries. Hence, they cannot be applied with accuracy on patients that do not conform to the fixed standard. Typical examples of such patients are obese patients or fetuses. For the latter category, when recording the fetal ECG from the maternal abdomen the distance of the fetal heart with respect to the electrodes is unknown. Consequently, also the signal attenuation/transformation per electrode is not known. In this paper, a Bayesian method is developed that estimates the VCG and, to some extent, also the signal attenuation in multichannel ECG recordings from either the adult 12-lead ECG or the maternal abdomen. This is done by determining for which VCG and signal attenuation the joint probability over both these variables is maximal given the observed ECG signals. The underlying joint probability distribution is determined by assuming the ECG signals to originate from scaled VCG projections and additive noise. With this method, a VCG, tailored to each specific patient, is determined. The method is compared to the inverse Dower matrix method by applying both methods on standard 12-lead ECG recordings and evaluating the performance in predicting ECG signals from the determined VCG. In addition, to model nonstandard patients, the 12-lead ECG signals are randomly scaled and, once more, the performance in predicting ECG signals from the VCG is compared between both methods. Finally, both methods are also compared on fetal ECG signals that are obtained from the maternal abdomen. For patients conforming to the standard, both methods perform similarly, with the developed method performing marginally better. For scaled ECG signals and fetal ECG signals, the developed method significantly outperforms the inverse Dower matrix method.