From: Lina on 3 May 2010 15:53 Hi I need to convert many .dot files to dotx or dotm. I would like to do something like this If mytemp has code then save as dotm else save as dotx End if Can you do this with vba? thanks
From: DaveLett on 3 May 2010 16:49 I think you're looking for something like the following: If ActiveDocument.VBProject.VBComponents.Count > 1 Then '''saveas dotm Else '''saveas dotx End If HTH, Dave "Lina" wrote: > Hi > I need to convert many .dot files to dotx or dotm. I would like to do > something like this > If mytemp has code then > save as dotm > else > save as dotx > End if > Can you do this with vba? > thanks > >
From: macropod on 3 May 2010 18:48 Hi Dave, Somewhat simpler: Sub Demo() With ActiveDocument If .HasVBProject Then 'saveas dotm Else 'saveas dotx End If End With End Sub -- Cheers macropod [Microsoft MVP - Word] "DaveLett" <DaveLett(a)discussions.microsoft.com> wrote in message news:66B0EA98-9413-4EF4-8914-AAD460C739B4(a)microsoft.com... >I think you're looking for something like the following: > > If ActiveDocument.VBProject.VBComponents.Count > 1 Then > '''saveas dotm > Else > '''saveas dotx > End If > > HTH, > Dave > > "Lina" wrote: > >> Hi >> I need to convert many .dot files to dotx or dotm. I would like to do >> something like this >> If mytemp has code then >> save as dotm >> else >> save as dotx >> End if >> Can you do this with vba? >> thanks >> >>
From: Lina on 4 May 2010 11:28 Thank you, now I have a new problem, when I save the dot files as dotm or dotx with vba the new files become corrupted and can not be opened im using mydoc.SaveAs FileName:=strFileName, _ FileFormat:=wdFormatTemplate "macropod" wrote: > Hi Dave, > > Somewhat simpler: > > Sub Demo() > With ActiveDocument > If .HasVBProject Then > 'saveas dotm > Else > 'saveas dotx > End If > End With > End Sub > > > -- > Cheers > macropod > [Microsoft MVP - Word] > > > "DaveLett" <DaveLett(a)discussions.microsoft.com> wrote in message news:66B0EA98-9413-4EF4-8914-AAD460C739B4(a)microsoft.com... > >I think you're looking for something like the following: > > > > If ActiveDocument.VBProject.VBComponents.Count > 1 Then > > '''saveas dotm > > Else > > '''saveas dotx > > End If > > > > HTH, > > Dave > > > > "Lina" wrote: > > > >> Hi > >> I need to convert many .dot files to dotx or dotm. I would like to do > >> something like this > >> If mytemp has code then > >> save as dotm > >> else > >> save as dotx > >> End if > >> Can you do this with vba? > >> thanks > >> > >> > . >
From: Graham Mayor on 5 May 2010 01:14
Save as (dotx) FileFormat:=wdFormatXMLTemplate or (dotm) FileFormat:=wdFormatXMLTemplateMacroEnabled -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> "Lina" <Lina(a)discussions.microsoft.com> wrote in message news:BE6FCA97-634E-4261-AA99-248796799CAA(a)microsoft.com... > Thank you, now I have a new problem, when I save the dot files as dotm or > dotx with vba the new files become corrupted and can not be opened > > im using > > mydoc.SaveAs FileName:=strFileName, _ > FileFormat:=wdFormatTemplate > > "macropod" wrote: > >> Hi Dave, >> >> Somewhat simpler: >> >> Sub Demo() >> With ActiveDocument >> If .HasVBProject Then >> 'saveas dotm >> Else >> 'saveas dotx >> End If >> End With >> End Sub >> >> >> -- >> Cheers >> macropod >> [Microsoft MVP - Word] >> >> >> "DaveLett" <DaveLett(a)discussions.microsoft.com> wrote in message >> news:66B0EA98-9413-4EF4-8914-AAD460C739B4(a)microsoft.com... >> >I think you're looking for something like the following: >> > >> > If ActiveDocument.VBProject.VBComponents.Count > 1 Then >> > '''saveas dotm >> > Else >> > '''saveas dotx >> > End If >> > >> > HTH, >> > Dave >> > >> > "Lina" wrote: >> > >> >> Hi >> >> I need to convert many .dot files to dotx or dotm. I would like to do >> >> something like this >> >> If mytemp has code then >> >> save as dotm >> >> else >> >> save as dotx >> >> End if >> >> Can you do this with vba? >> >> thanks >> >> >> >> >> . >> |