![]() |
|
#1
|
|||
|
|||
|
Hello!
I would like to merge 2 macros into 1, so that when I make the macro shortcut button it would do the 2 functions in just one click. I'm trying to merge Code:
Sub AutoNew()
Dim InvoiceFile As String, InvNum As String
'Save ini file in the Word startup folder.
InvoiceFile = Options.DefaultFilePath(wdStartupPath) & "\Invoice.ini"
'or, by using the following line, the Workgroup folder
'InvoiceFile = Options.DefaultFilePath(wdWorkgroupTemplatesPath) & "\Invoice.ini"
InvNum = System.PrivateProfileString(InvoiceFile, "InvoiceNumber", "InvNum")
'If there is no InvoiceNumber reference in the ini file
'Create one and set the number to 1, otherwise increment the number
If InvNum = "" Then
InvNum = 1
Else
InvNum = InvNum + 1
End If
System.PrivateProfileString(InvoiceFile, "InvoiceNumber", "InvNum") = InvNum
With ActiveDocument
.CustomDocumentProperties("InvNum") = InvNum
.Fields.Update
End With
End Sub
Code:
Sub ResetForm()
MsgBox "test"
Dim oFF As FormField
For Each oFF In ActiveDocument.Range.FormFields
Select Case oFF.Type
Case Is = wdFieldFormTextInput
oFF.Result = ""
Case Is = wdFieldFormDropDown
oFF.DropDown.Value = 1
Case Else
'Do Nothing
End Select
Next oFF
End Sub
Thank You for your help!! Last edited by macropod; 05-26-2012 at 06:35 PM. Reason: Added code tags & formatting |
|
#2
|
||||
|
||||
|
Hi yessmarie,
You could simply add 'Call ResetForm' at whatever you consider the appropriate point in the 'AutoNew' macro. PS: When posting code, please use the code tags - they're available via the 'Go Advanced' tab.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Conditional merge fields in mail merge
|
Aude | Mail Merge | 1 | 01-06-2012 07:38 PM |
VBA macros
|
tays01s | Word VBA | 6 | 08-03-2011 09:42 PM |
| Macros | nore | Outlook | 0 | 06-01-2011 04:39 PM |
| Macros | Steveg | Word VBA | 0 | 08-18-2010 04:04 PM |
Macros
|
Desertwrangler | Word VBA | 6 | 06-25-2010 07:06 AM |