From: Lina on 6 May 2010 06:53 Thanks it works perfectly now!!! "Graham Mayor" wrote: > 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 > >> >> > >> >> > >> . > >> > > > . >
From: Graham Mayor on 6 May 2010 08:26
You are welcome :) -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> 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:D47B04B3-71F4-4D97-9093-0B4A99DBDFE5(a)microsoft.com... > Thanks it works perfectly now!!! > > "Graham Mayor" wrote: > >> 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 >> >> >> >> >> >> >> >> . >> >> >> >> >> . >> |