Thread: [Solved] Merge Macros
View Single Post
 
Old 05-26-2012, 11:45 AM
yessmarie yessmarie is offline Windows 7 64bit Office 2007
Novice
 
Join Date: May 2012
Posts: 4
yessmarie is on a distinguished road
Lightbulb Merge Macros

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
Could this be done???/

Thank You for your help!!

Last edited by macropod; 05-26-2012 at 06:35 PM. Reason: Added code tags & formatting
Reply With Quote