General discussion

Locked

LOOPED MACROS? HOW?

By cgtull ·
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?

This conversation is currently closed to new comments.

8 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

LOOPED MACROS? HOW?

by SteveD In reply to LOOPED MACROS? HOW?

What software are you using to print the bills of lading? Excel? Access? Word? Something else? The answer will depend on the software.

Collapse -

LOOPED MACROS? HOW?

by cgtull In reply to LOOPED MACROS? HOW?

I AM USING EXCEL 97 TO PRINT BILLS OF LADING.

Collapse -

LOOPED MACROS? HOW?

by Garlin In reply to 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 add
copy numbers to a document. The solution relied upon the use of
document variables. Unfortunately, this solution will not work in all
versions of Word. For instance, if you place the DOCVARIABLE field in
the header of a Word 97 document and then print the document, Word
will promptly crash.

How to get around this? Simply use a different approach. (Word is
nothing, if not flexible.) The following VBA macro is a variation on
the one presented last week. It relies on the use of custom document
properties instead of document variables. (You can see document
properties 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

Collapse -

LOOPED MACROS? HOW?

by cgtull In reply to LOOPED MACROS? HOW?

IT IS IN EXCEL 97 I AM SORRY. PLEASE HELP! ( BUT VERY VERY INFORMATIVE IN WORD. I MAY KEEP THE IDEA FOR LATER USE IN WORD.
THANKS.

Collapse -

LOOPED MACROS? HOW?

by SteveD In reply to LOOPED MACROS? HOW?

Create a macro something like this:

Sub BOL_Print()
Dim j As Integer, k As Integer, n As Integer
k = 22
n = 252
For j = k To n
Range("A2").Select
ActiveCell.FormulaR1C1 = CStr(j)
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Next j
End Sub

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.)

Collapse -

LOOPED MACROS? HOW?

by SteveD In reply to LOOPED MACROS? HOW?

Please ignore the postscript. My mistake. I see now that it quite intelligently created a new unrated answer from my last posting. Sorry. - SMD

Collapse -

LOOPED MACROS? HOW?

by cgtull In reply to 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

Collapse -

LOOPED MACROS? HOW?

by cgtull In reply to LOOPED MACROS? HOW?

This question was closed by the author

Back to Software Forum
8 total posts (Page 1 of 1)  

Related Discussions

Related Forums