Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-26-2012, 11:45 AM
yessmarie yessmarie is offline Merge Macros Windows 7 64bit Merge Macros Office 2007
Novice
Merge Macros
 
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
  #2  
Old 05-26-2012, 06:37 PM
macropod's Avatar
macropod macropod is offline Merge Macros Windows 7 64bit Merge Macros Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Merge Macros Conditional merge fields in mail merge Aude Mail Merge 1 01-06-2012 07:38 PM
Merge Macros 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
Merge Macros Macros Desertwrangler Word VBA 6 06-25-2010 07:06 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:54 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft