Software

General discussion

LOOPED MACROS? HOW?

I PRINT SEVERAL HUNDRED BILL OF LADINGS AT MY WORK AND WISH TO KNOW HOW TO CREAT ONE PAGE OF INFORMATION, BUT ON THE OTHER HAND WANT THE PAGE TO AUTOMATICALLY CHANGE BILL NUMBERS WHILE REPETEDLY PRINTING AFTER EACH NUMBER CHANGE. HOW CAN I ACCOMPLISH THIS TASK?

LOOPED MACROS? HOW?

LOOPED MACROS? HOW?

The following article from the September 2000 version of Wordtips may interest you.

In the article is also a link so you can subscribe to future issues.

------------------------------Printing Copy Numbers, Take Two------------------------------In last week's WordTips I featured a tip that discussed how to addcopy numbers to a document. The solution relied upon the use ofdocument variables. Unfortunately, this solution will not work in allversions of Word. For instance, if you place the DOCVARIABLE field inthe header of a Word 97 document and then print the document, Wordwill promptly crash.

How to get around this? Simply use a different approach. (Word isnothing, if not flexible.) The following VBA macro is a variation onthe one presented last week. It relies on the use of custom documentproperties instead of document variables. (You can see documentproperties if you choose Properties from the File menu.)

Public Sub PrintNumberedCopies() Dim varItem As DocumentProperty Dim bExists As Boolean Dim lCopiesToPrint As Long Dim lCounter As Long Dim lCopyNumFrom As Long

' ensure our doc variable exists bExists = False For Each varItem In ActiveDocument.CustomDocumentProperties If varItem.Name = "CopyNum" Then bExists = True Exit For End If Next varItem

' initialize document variable if doesn't exist If Not bExists Then ActiveDocument.CustomDocumentProperties.Add _ Name:="CopyNum", LinkToContent:=False, _ Type:=msoPropertyTypeNumber, Value:=0 End If ' ask how many to print lCopiesToPrint = InputBox( _ Prompt:="How many copies?", _ Title:="Print And Number Copies", _ De

For the values 22 and 252, substitute your own starting and ending bill of lading numbers. For "A2" substitute the cell number where your bill of lading number is contained in the worksheet.I hope this helps.

Steve Diamond

(By the way, if you had left my answer unrated instead of rejecting it, this system might have worked OK. It won't let me start a new answer since I've already answered. If you like this answer, you'll have to try to un-reject my answer, and I'm not sure whether or not it will let you do that.)

LOOPED MACROS? HOW?

THE INFORMATION YOU HAVE SUPPORTED ME WAS EXCELLENT IT DID WORK BUT AS FOR THE 252 I MAY HAVE PRINTED DIDNT HAPPEN. ) I GUESS THATS FAIR FOR REJECTING YOUR ANSWER. "RATE THIS ANSWER" THATS WHAT I DID YOUR FIRST ANSWER DID NOT HELP SO I PUT IT DIDNT HELP..... I AM SORRY AND VERY GREATFUL OF YOUR HELP IN THIS MATTER ) CGTULL@SLAY.COM

Start or search

Create a new discussion

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

Post type

Subject title

Topic Tags

Select up to 3 tags (1 tag required)

Cloud

Piracy

Security

Apple

Microsoft

IT Employment

Google

Open Source

Mobility

Social Enterprise

Community

Smartphones

Operating Systems

Windows

Mac

Malware

Tablets

Networking

Browser

Hardware

Software

Web Developerment

Linux

Off Topic

Message Body

Track this discussion and email me when there are updates

Please note: Do not post advertisements, offensive material, profanity, or personal attacks. Please remember to be considerate of other members. If you're new to the TechRepublic Forums, please read our TechRepublic Forums FAQ. All submitted content is subject to our Terms Of Use.