Group:  Microsoft Word ยป microsoft.public.word.docmanagement
Thread: Simple macro used to work...?

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Simple macro used to work...?
Kenneth <usenet[ at ]soleSPAMLESSassociates.com> 25.09.2006 14:15:02

Howdy,

I have a very simple macro that was used to open the save
dialog to a particular folder. It would not assign a file
name. I would then type in the filename, and save.

It worked fine for many months.

Now, I get an error telling me that "This is not a valid
filename."

Here's the code:



Sub CorresSave()
'
' CorresSave Macro
'
ChangeFileOpenDirectory "F:\Corres06\"
ActiveDocument.SaveAs FileName:="", FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="",
AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False,
SaveFormsData:=False, _
SaveAsAOCELetter:=False
End Sub



Thanks for any help on this,
--
Kenneth

If you email... Please remove the "SPAMLESS."
Re: Simple macro used to work...?
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 25.09.2006 14:53:04
I can't see why it ecer worked with a filename seat as ""

Try

Sub CorresSave()
ChangeFileOpenDirectory "F:\Corres06\"
FileSaveAs
End Sub

Instead


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Kenneth wrote:
[Quoted Text]
> Howdy,
>
> I have a very simple macro that was used to open the save
> dialog to a particular folder. It would not assign a file
> name. I would then type in the filename, and save.
>
> It worked fine for many months.
>
> Now, I get an error telling me that "This is not a valid
> filename."
>
> Here's the code:
>
>
>
> Sub CorresSave()
> '
> ' CorresSave Macro
> '
> ChangeFileOpenDirectory "F:\Corres06\"
> ActiveDocument.SaveAs FileName:="", FileFormat:= _
> wdFormatDocument, LockComments:=False, Password:="",
> AddToRecentFiles:= _
> True, WritePassword:="", ReadOnlyRecommended:=False,
> EmbedTrueTypeFonts:= _
> False, SaveNativePictureFormat:=False,
> SaveFormsData:=False, _
> SaveAsAOCELetter:=False
> End Sub
>
>
>
> Thanks for any help on this,


Re: Simple macro used to work...?
Kenneth <usenet[ at ]soleSPAMLESSassociates.com> 25.09.2006 15:17:09
On Mon, 25 Sep 2006 17:53:04 +0300, "Graham Mayor"
<gmayor[ at ]REMOVETHISmvps.org> wrote:

[Quoted Text]
>I can't see why it ecer worked with a filename seat as ""
>
>Try
>
>Sub CorresSave()
> ChangeFileOpenDirectory "F:\Corres06\"
> FileSaveAs
>End Sub
>
>Instead
>
>
>--
><>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>Graham Mayor - Word MVP
>
>My web site www.gmayor.com
>Word MVP web site http://word.mvps.org
><>>< ><<> ><<> <>>< ><<> <>>< <>><<>


Hi Graham,

I very much appreciate your speedy response, but it has a
problem that you may be able to resolve.

When I run this:


Sub CorresSave2()
'
' Macro1 Macro
' Macro recorded 9/25/2006 by
'
ChangeFileOpenDirectory "F:\Corres06\"
FileSaveAs
End Sub


I get the error "Sub or function not defined" with the
yellow on FileSaveAs.

Can you assist further?

Sincere thanks,
--
Kenneth

If you email... Please remove the "SPAMLESS."
Re: Simple macro used to work...?
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 26.09.2006 05:27:07
Oops - my fault. I called a simple routine from the macro which I didn't add
:(
Add the following :

Sub FileSaveAs()
Dialogs(wdDialogFileSaveAs).Show
ActiveWindow.Caption = ActiveDocument.FullName
End Sub
Sub CorresSave()
ChangeFileOpenDirectory "F:\Corres06\"
FileSaveAs
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Kenneth wrote:
[Quoted Text]
> On Mon, 25 Sep 2006 17:53:04 +0300, "Graham Mayor"
> <gmayor[ at ]REMOVETHISmvps.org> wrote:
>
>> I can't see why it ever worked with a filename set as ""
>>
>> Try
>>
>> Sub CorresSave()
>> ChangeFileOpenDirectory "F:\Corres06\"
>> FileSaveAs
>> End Sub
>>
>> Instead
>>
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor - Word MVP
>>
>> My web site www.gmayor.com
>> Word MVP web site http://word.mvps.org
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
> Hi Graham,
>
> I very much appreciate your speedy response, but it has a
> problem that you may be able to resolve.
>
> When I run this:
>
>
> Sub CorresSave2()
> '
> ' Macro1 Macro
> ' Macro recorded 9/25/2006 by
> '
> ChangeFileOpenDirectory "F:\Corres06\"
> FileSaveAs
> End Sub
>
>
> I get the error "Sub or function not defined" with the
> yellow on FileSaveAs.
>
> Can you assist further?
>
> Sincere thanks,


Re: Simple macro used to work...?
Kenneth <usenet[ at ]soleSPAMLESSassociates.com> 26.09.2006 13:18:23
On Tue, 26 Sep 2006 08:27:07 +0300, "Graham Mayor"
<gmayor[ at ]REMOVETHISmvps.org> wrote:

[Quoted Text]
>Oops - my fault. I called a simple routine from the macro which I didn't add
>:(
>Add the following :
>
>Sub FileSaveAs()
>Dialogs(wdDialogFileSaveAs).Show
>ActiveWindow.Caption = ActiveDocument.FullName
>End Sub
>Sub CorresSave()
>ChangeFileOpenDirectory "F:\Corres06\"
>FileSaveAs
>End Sub

Hi Graham,

Please accept my thanks,
--
Kenneth

If you email... Please remove the "SPAMLESS."
Re: Simple macro used to work...?
Kenneth <usenet[ at ]soleSPAMLESSassociates.com> 26.09.2006 19:13:15
On Tue, 26 Sep 2006 08:27:07 +0300, "Graham Mayor"
<gmayor[ at ]REMOVETHISmvps.org> wrote:


Hi again Graham,

Perhaps you can help me with another one.

It is a similar story:

The macro used to work properly under Win 2000 Pro. Now, I
have it on an XP box, and it has a (small) problem.

Below is code that is to print nametags. It used to work
with no intervention, but now, it works properly until
displaying the Print Dialog. The dialog shows the correct
printer (OKI) but just sits there until I manually click
"OK" to actually launch the printing.

I have experimented quite a bit with SendKeys "~" to try to
get past the dialog, but have had no luck.






Sub Nametags()
'
' Nametags Macro
' Macro recorded 7/18/2000 by Kenneth Sole
'
Documents.Add Template:= _
"F:\Templates\Label 4x2.dot" _
, NewTemplate:=False, DocumentType:=0
Documents.Open FileName:="Z:\Data\let.txt",
ConfirmConversions:=False, ReadOnly:= _
False, AddToRecentFiles:=False,
PasswordDocument:="", PasswordTemplate:= _
"", Revert:=False, WritePasswordDocument:="",
WritePasswordTemplate:="", _
Format:=wdOpenFormatAuto
Selection.TypeText Text:="Last" & vbTab & "First" &
vbTab
Selection.TypeParagraph
ActiveDocument.Save
ActiveWindow.Close
Selection.Font.Size = 36
Selection.Font.Bold = wdToggle
ActiveDocument.MailMerge.MainDocumentType =
wdFormLetters
ActiveDocument.MailMerge.OpenDataSource
Name:="Z:\data\let.txt", _
ConfirmConversions:=False, ReadOnly:=False,
LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="",
WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="",
SQLStatement:="", SQLStatement1 _
:=""
ActiveDocument.MailMerge.EditMainDocument
ActiveDocument.MailMerge.Fields.Add
Range:=Selection.Range, Name:="First"
Selection.TypeParagraph
ActiveDocument.MailMerge.Fields.Add
Range:=Selection.Range, Name:="Last"
SendKeys "~"

ActivePrinter = "OKI"

With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With

ActivePrinter = "HP Color LaserJet 2500 PCL 6"

ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
Application.ScreenUpdating = True
Application.Quit

End Sub



Can you spot the problem?

Sincere thanks as before,
--
Kenneth

If you email... Please remove the "SPAMLESS."
Re: Simple macro used to work...?
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 27.09.2006 05:45:40
Just a guess but Pause:=True may have something to do with it?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Kenneth wrote:
[Quoted Text]
> On Tue, 26 Sep 2006 08:27:07 +0300, "Graham Mayor"
> <gmayor[ at ]REMOVETHISmvps.org> wrote:
>
>
> Hi again Graham,
>
> Perhaps you can help me with another one.
>
> It is a similar story:
>
> The macro used to work properly under Win 2000 Pro. Now, I
> have it on an XP box, and it has a (small) problem.
>
> Below is code that is to print nametags. It used to work
> with no intervention, but now, it works properly until
> displaying the Print Dialog. The dialog shows the correct
> printer (OKI) but just sits there until I manually click
> "OK" to actually launch the printing.
>
> I have experimented quite a bit with SendKeys "~" to try to
> get past the dialog, but have had no luck.
>
>
>
>
>
>
> Sub Nametags()
> '
> ' Nametags Macro
> ' Macro recorded 7/18/2000 by Kenneth Sole
> '
> Documents.Add Template:= _
> "F:\Templates\Label 4x2.dot" _
> , NewTemplate:=False, DocumentType:=0
> Documents.Open FileName:="Z:\Data\let.txt",
> ConfirmConversions:=False, ReadOnly:= _
> False, AddToRecentFiles:=False,
> PasswordDocument:="", PasswordTemplate:= _
> "", Revert:=False, WritePasswordDocument:="",
> WritePasswordTemplate:="", _
> Format:=wdOpenFormatAuto
> Selection.TypeText Text:="Last" & vbTab & "First" &
> vbTab
> Selection.TypeParagraph
> ActiveDocument.Save
> ActiveWindow.Close
> Selection.Font.Size = 36
> Selection.Font.Bold = wdToggle
> ActiveDocument.MailMerge.MainDocumentType =
> wdFormLetters
> ActiveDocument.MailMerge.OpenDataSource
> Name:="Z:\data\let.txt", _
> ConfirmConversions:=False, ReadOnly:=False,
> LinkToSource:=True, _
> AddToRecentFiles:=False, PasswordDocument:="",
> PasswordTemplate:="", _
> WritePasswordDocument:="",
> WritePasswordTemplate:="", Revert:=False, _
> Format:=wdOpenFormatAuto, Connection:="",
> SQLStatement:="", SQLStatement1 _
> :=""
> ActiveDocument.MailMerge.EditMainDocument
> ActiveDocument.MailMerge.Fields.Add
> Range:=Selection.Range, Name:="First"
> Selection.TypeParagraph
> ActiveDocument.MailMerge.Fields.Add
> Range:=Selection.Range, Name:="Last"
> SendKeys "~"
>
> ActivePrinter = "OKI"
>
> With ActiveDocument.MailMerge
> .Destination = wdSendToPrinter
> .MailAsAttachment = False
> .MailAddressFieldName = ""
> .MailSubject = ""
> .SuppressBlankLines = True
> With .DataSource
> .FirstRecord = wdDefaultFirstRecord
> .LastRecord = wdDefaultLastRecord
> End With
> .Execute Pause:=True
> End With
>
> ActivePrinter = "HP Color LaserJet 2500 PCL 6"
>
> ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
> Application.ScreenUpdating = True
> Application.Quit
>
> End Sub
>
>
>
> Can you spot the problem?
>
> Sincere thanks as before,


Re: Simple macro used to work...?
Kenneth <usenet[ at ]soleSPAMLESSassociates.com> 27.09.2006 14:18:31
On Wed, 27 Sep 2006 08:45:40 +0300, "Graham Mayor"
<gmayor[ at ]REMOVETHISmvps.org> wrote:

[Quoted Text]
>Just a guess but Pause:=True may have something to do with it?

Hi Graham,

When I rem out the pause nothing at all happens, that is, no
print dialog, and no printing.

I was of the understanding that the SendKeys "~" would
"Push the button" on the print dialog, but now, for some
reason, that is not happening.

Any other thoughts on this?

Sincere thanks,
--
Kenneth

If you email... Please remove the "SPAMLESS."
Re: Simple macro used to work...?
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 28.09.2006 05:21:12
I have tested this macro (albeit with a different template and data file)
and it works as it stands. Do you have a default printer set in Windows and
is it a printer that is connected to a printer port and not to file?

Where did you rem out the pause?
It should have been at
.Execute 'Pause:=True

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Kenneth wrote:
[Quoted Text]
> On Wed, 27 Sep 2006 08:45:40 +0300, "Graham Mayor"
> <gmayor[ at ]REMOVETHISmvps.org> wrote:
>
>> Just a guess but Pause:=True may have something to do with it?
>
> Hi Graham,
>
> When I rem out the pause nothing at all happens, that is, no
> print dialog, and no printing.
>
> I was of the understanding that the SendKeys "~" would
> "Push the button" on the print dialog, but now, for some
> reason, that is not happening.
>
> Any other thoughts on this?
>
> Sincere thanks,


Re: Simple macro used to work...?
Kenneth <usenet[ at ]soleSPAMLESSassociates.com> 28.09.2006 11:39:10
On Thu, 28 Sep 2006 08:21:12 +0300, "Graham Mayor"
<gmayor[ at ]REMOVETHISmvps.org> wrote:

[Quoted Text]
>I have tested this macro (albeit with a different template and data file)
>and it works as it stands. Do you have a default printer set in Windows and
>is it a printer that is connected to a printer port and not to file?
>
>Where did you rem out the pause?
>It should have been at
> .Execute 'Pause:=True

Hi Graham,

I do have a default printer set, but it is not the one that
my macro prints to. I do not print to file.

I remmed out the .Execute 'Pause:=True and found that
nothing happened, that is, no print dialog opened and no
printing occurred.

I then re-created the macro (by recording) as I moved
through every step finally clicking the print dialog box to
print. When I looked at the code that had been recorded, the
pause had been inserted. And, that is the version you have
seen.

When I ran it, rather than printing, it behaved as I have
described before, the print dialog opened as it should, but
I had to manually click to print.

And finally, I started the new thread because I did not know
that you had further thoughts and I was hoping to get this
resolved if I could.

I sincerely appreciate your assistance, and, of course, will
stick to this thread.

Thanks again,
--
Kenneth

If you email... Please remove the "SPAMLESS."
Re: Simple macro used to work...?
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 28.09.2006 12:17:58
There is no code in your macro to change printers?

I have tested your code (changing only the templatename and the data file)
and it works here without pause straight to the default printer.

Strip out some of the extra stuff the recorder adds and then you get the
following to which (as this appears to be a label merge), the appropriate
document type and the propagation to the other labels of the inserted data
has been added.

Documents.Add Template:= "F:\Templates\Label 4x2.dot"
Selection.Font.Size = 36
Selection.Font.Bold = True
With ActiveDocument.MailMerge
.MainDocumentType = wdMailingLabels
.OpenDataSource Name:= "Z:\Data\let.txt"
.EditMainDocument
.Fields.Add Range:=Selection.Range, Name:="First"
WordBasic.MailMergePropagateLabel
.Destination = wdSendToPrinter
.SuppressBlankLines = True
.Execute
End With

As for having further thoughts, I am undoubtedly in a different time zone to
you (Eastern Europe), hence I may not respond when you expect. The regular
contributors here will jump in if they have anything to offer - but for
myself, I am fast running out of ideas. I would suggest that you look at
your template to see what is happening there, and to your printer
properties - for the macro works. This macro (now) puts the firstname field
from the data file into a table (the template), formats that field as 36
point bold and (now copies that field to all the other cells before) it
merges to the ActivePrinter. If you want to know how to change the active
printer, see http://www.gmayor.com/fax_from_word.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Kenneth wrote:
[Quoted Text]
> On Thu, 28 Sep 2006 08:21:12 +0300, "Graham Mayor"
> <gmayor[ at ]REMOVETHISmvps.org> wrote:
>
>> I have tested this macro (albeit with a different template and data
>> file) and it works as it stands. Do you have a default printer set
>> in Windows and is it a printer that is connected to a printer port
>> and not to file?
>>
>> Where did you rem out the pause?
>> It should have been at
>> .Execute 'Pause:=True
>
> Hi Graham,
>
> I do have a default printer set, but it is not the one that
> my macro prints to. I do not print to file.
>
> I remmed out the .Execute 'Pause:=True and found that
> nothing happened, that is, no print dialog opened and no
> printing occurred.
>
> I then re-created the macro (by recording) as I moved
> through every step finally clicking the print dialog box to
> print. When I looked at the code that had been recorded, the
> pause had been inserted. And, that is the version you have
> seen.
>
> When I ran it, rather than printing, it behaved as I have
> described before, the print dialog opened as it should, but
> I had to manually click to print.
>
> And finally, I started the new thread because I did not know
> that you had further thoughts and I was hoping to get this
> resolved if I could.
>
> I sincerely appreciate your assistance, and, of course, will
> stick to this thread.
>
> Thanks again,


Re: Simple macro used to work...?
Kenneth <usenet[ at ]soleSPAMLESSassociates.com> 28.09.2006 12:59:54
On Thu, 28 Sep 2006 15:17:58 +0300, "Graham Mayor"
<gmayor[ at ]REMOVETHISmvps.org> wrote:

[Quoted Text]
>There is no code in your macro to change printers?
>
>I have tested your code (changing only the templatename and the data file)
>and it works here without pause straight to the default printer.
>
>Strip out some of the extra stuff the recorder adds and then you get the
>following to which (as this appears to be a label merge), the appropriate
>document type and the propagation to the other labels of the inserted data
>has been added.
>
>Documents.Add Template:= "F:\Templates\Label 4x2.dot"
> Selection.Font.Size = 36
> Selection.Font.Bold = True
> With ActiveDocument.MailMerge
> .MainDocumentType = wdMailingLabels
> .OpenDataSource Name:= "Z:\Data\let.txt"
> .EditMainDocument
> .Fields.Add Range:=Selection.Range, Name:="First"
> WordBasic.MailMergePropagateLabel
> .Destination = wdSendToPrinter
> .SuppressBlankLines = True
> .Execute
> End With
>
>As for having further thoughts, I am undoubtedly in a different time zone to
>you (Eastern Europe), hence I may not respond when you expect. The regular
>contributors here will jump in if they have anything to offer - but for
>myself, I am fast running out of ideas. I would suggest that you look at
>your template to see what is happening there, and to your printer
>properties - for the macro works. This macro (now) puts the firstname field
>from the data file into a table (the template), formats that field as 36
>point bold and (now copies that field to all the other cells before) it
>merges to the ActivePrinter. If you want to know how to change the active
>printer, see http://www.gmayor.com/fax_from_word.htm

Hi Graham,

Here is the code that I am using:

Sub NameTagsFirst()
'
' NameTagsFirst Macro
' Macro created 5/30/2002 by Kenneth Sole
'
'
Documents.Add Template:= _
"F:\Templates\Label 4x2.dot" _
, NewTemplate:=False, DocumentType:=0

With ActiveDocument.PageSetup
.TopMargin = InchesToPoints(0.7)
End With

Documents.Open FileName:="Z:\Data\let.txt",
ConfirmConversions:=False, ReadOnly:= _
False, AddToRecentFiles:=False,
PasswordDocument:="", PasswordTemplate:= _
"", Revert:=False, WritePasswordDocument:="",
WritePasswordTemplate:="", _
Format:=wdOpenFormatAuto
Selection.TypeText Text:="First" & vbTab
Selection.TypeParagraph
ActiveDocument.Save
ActiveWindow.Close

Selection.Font.Size = 36
Selection.Font.Bold = wdToggle

ActiveDocument.MailMerge.MainDocumentType =
wdFormLetters
ActiveDocument.MailMerge.OpenDataSource
Name:="Z:\data\let.txt", _
ConfirmConversions:=False, ReadOnly:=False,
LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="",
WritePasswordTemplate:="", Revert:=False, _
Format:=wdOpenFormatAuto, Connection:="",
SQLStatement:="", SQLStatement1 _
:=""
ActiveDocument.MailMerge.EditMainDocument
ActiveDocument.MailMerge.Fields.Add
Range:=Selection.Range, Name:="First"

ActivePrinter = "OKI"

With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With

.Execute Pause:=True


End With


ActivePrinter = "HP Color LaserJet 2500 PCL 6"

ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
Application.ScreenUpdating = True
Application.Quit


End Sub


It sets the active printer to "OKI" and then at the end,
sets back to a sheet printer.

I will certainly experiment with the stripped down code you
suggest, and as before, offer my sincere thanks,
--
Kenneth

If you email... Please remove the "SPAMLESS."
Re: Simple macro used to work...?
Kenneth <usenet[ at ]soleSPAMLESSassociates.com> 28.09.2006 16:40:07
On Thu, 28 Sep 2006 08:59:54 -0400, Kenneth
<usenet[ at ]soleSPAMLESSassociates.com> wrote:

[Quoted Text]
>On Thu, 28 Sep 2006 15:17:58 +0300, "Graham Mayor"
><gmayor[ at ]REMOVETHISmvps.org> wrote:
>

Hi Graham,

(With apologies if this is a duplicate...)

Below is my stripped down code as per your suggestion. It
runs with the Run Time Error 438 "Object doesn't support
this property or method on the line I have marked.


Sub Macro8()
'
' NameTagsFirst Macro
' Macro created 5/30/2002 by Kenneth Sole
'
'
Documents.Add Template:="F:\Templates\Label 4x2.dot"

ActivePrinter = "OKI"

Selection.Font.Size = 36
Selection.Font.Bold = True

With ActiveDocument.MailMerge
.MainDocumentType = wdMailingLabels
.OpenDataSource Name:="Z:\data\let.txt"
.EditMainDocument
.Fields.Add Range:=Selection.Range, Name:="First"
>>>>> WordBasic.MailMergePropagateLabel <<<<<<<
.Destination = wdSendToPrinter
.SuppressBlankLines = True
.Execute
End With

ActivePrinter = "HP Color LaserJet 2500 PCL 6"
ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
Application.ScreenUpdating = True
Application.Quit

End Sub


Thanks for any further help,
--
Kenneth

If you email... Please remove the "SPAMLESS."
Re: Simple macro used to work...?
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 29.09.2006 06:05:54
Is this Word 2003? What reference libraries do you have checked in the vba
editor (Tools > References) Make sure the Microsoft Word 11 and Microsoft
Office 11 object libraries are checked.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Kenneth wrote:
[Quoted Text]
> On Thu, 28 Sep 2006 08:59:54 -0400, Kenneth
> <usenet[ at ]soleSPAMLESSassociates.com> wrote:
>
>> On Thu, 28 Sep 2006 15:17:58 +0300, "Graham Mayor"
>> <gmayor[ at ]REMOVETHISmvps.org> wrote:
>>
>
> Hi Graham,
>
> (With apologies if this is a duplicate...)
>
> Below is my stripped down code as per your suggestion. It
> runs with the Run Time Error 438 "Object doesn't support
> this property or method on the line I have marked.
>
>
> Sub Macro8()
> '
> ' NameTagsFirst Macro
> ' Macro created 5/30/2002 by Kenneth Sole
> '
> '
> Documents.Add Template:="F:\Templates\Label 4x2.dot"
>
> ActivePrinter = "OKI"
>
> Selection.Font.Size = 36
> Selection.Font.Bold = True
>
> With ActiveDocument.MailMerge
> .MainDocumentType = wdMailingLabels
> .OpenDataSource Name:="Z:\data\let.txt"
> .EditMainDocument
> .Fields.Add Range:=Selection.Range, Name:="First"
> >>>>> WordBasic.MailMergePropagateLabel <<<<<<<
> .Destination = wdSendToPrinter
> .SuppressBlankLines = True
> .Execute
> End With
>
> ActivePrinter = "HP Color LaserJet 2500 PCL 6"
> ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
> Application.ScreenUpdating = True
> Application.Quit
>
> End Sub
>
>
> Thanks for any further help,


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net