M
Michael T
I have a macro (in VB) as shown down below invoked by F11 - I created it
initially
with record macro. It allows me to type in a name for an invoice and
increment
the invoice number.
When I first press F11 it invokes two consecutive
message boxes to accept input to update two fields on the invoice.
The first message box comes up with the current value of the field from the
invoice template (Client Name).
I change the name in the this first message box and press OK on the message
box.
The second message box comes up with the current value of the field from the
invoice template (01) which is fine for the first invoice so I press OK on
the message box and the macro then prints the invoice.
When I next press F11 the first message box pops up with the previous value
that I have typed in last (a name), I alter this, press OK and then the next
message
box pops up with the invoice number value from the invoice template (i.e.
01). What I
would like to do is to increment the value of the invoice number field
displayed BEFORE the second message box pops up - specifically to add 1 to
the value of a counter so that I don't normally have to change it.
The trouble is that I do not seem to be able to access the value in the
Message Box from within VB since the Message Box processing is automatic and
does not actually appear in the VB code.
Does anyone have any ideas please?
Thanks, Michael.
------------------------------------------------------------------------------
Sub ClientReceipt()
'
' ClientReceipt Macro
' Macro recorded 13/04/2008 by M Tidbury
' Invoked by F11
' Fields include:
' "REF ReceiptHeader" which is the -NN at the end of the receipt number
Selection.WholeStory
Selection.Fields.Update ' Invoke dialogue boxes to
update fields
Selection.EscapeKey
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=4
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.MoveRight Unit:=wdCharacter, Count:=1
'ActiveDocument.PrintOut
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True,
PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0,
_
PrintZoomPaperHeight:=0
End Sub
initially
with record macro. It allows me to type in a name for an invoice and
increment
the invoice number.
When I first press F11 it invokes two consecutive
message boxes to accept input to update two fields on the invoice.
The first message box comes up with the current value of the field from the
invoice template (Client Name).
I change the name in the this first message box and press OK on the message
box.
The second message box comes up with the current value of the field from the
invoice template (01) which is fine for the first invoice so I press OK on
the message box and the macro then prints the invoice.
When I next press F11 the first message box pops up with the previous value
that I have typed in last (a name), I alter this, press OK and then the next
message
box pops up with the invoice number value from the invoice template (i.e.
01). What I
would like to do is to increment the value of the invoice number field
displayed BEFORE the second message box pops up - specifically to add 1 to
the value of a counter so that I don't normally have to change it.
The trouble is that I do not seem to be able to access the value in the
Message Box from within VB since the Message Box processing is automatic and
does not actually appear in the VB code.
Does anyone have any ideas please?
Thanks, Michael.
------------------------------------------------------------------------------
Sub ClientReceipt()
'
' ClientReceipt Macro
' Macro recorded 13/04/2008 by M Tidbury
' Invoked by F11
' Fields include:
' "REF ReceiptHeader" which is the -NN at the end of the receipt number
Selection.WholeStory
Selection.Fields.Update ' Invoke dialogue boxes to
update fields
Selection.EscapeKey
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=4
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.MoveRight Unit:=wdCharacter, Count:=1
'ActiveDocument.PrintOut
Application.PrintOut FileName:="", Range:=wdPrintAllDocument, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
ManualDuplexPrint:=False, Collate:=True, Background:=True,
PrintToFile:= _
False, PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0,
_
PrintZoomPaperHeight:=0
End Sub