![]() |
#1
|
|||
|
|||
![]()
Hi all,
The code below was written by a previous employee and have very little experience doing VBA programming. Help how this should be written would of great assistance, to gmayor, how to do what you have below i have no idea. I am trying to edit a VBA macro to add the {MERGEfIELD number} to the save file name. the macro below is what I have but this only saves the file as Selectronic Purchase Order.doc. the document data looks like this Order Number: { MERGEFIELD number } Date: { MERGEFIELD date } Order Number: 130465 Date: 07/06/2017 any help with this would save time and errors. Sub OpenPurchaseOrdersSean() ' ' OpenPurchaseOrdersSean Macro ' ' ' ' WordBasic.FileOpen Name:="c:\flexsoft\poprint." WordBasic.FileSaveAs Name:="c:\flexsoft\Poprint.doc", Format:=0, LockAnnot:=0, Password:="", AddToMru:=1, WritePassword:="", RecommendReadOnly:=0, EmbedFonts:=0, NativePictureFormat:=0, FormsData:=0, SaveAsAOCELetter:=0 ' Search and replace " characters WordBasic.StartOfDocument WordBasic.StartOfLine WordBasic.EditFind Find:=Chr(34), Direction:=0, MatchCase:=0, WholeWord:=0, PatternMatch:=0, SoundsLike:=0, Format:=0, Wrap:=0 While WordBasic.EditFindFound() WordBasic.InsertSymbol Font:="Symbol", CharNum:="178" WordBasic.EditFind Find:=Chr(34), Direction:=0, MatchCase:=0, WholeWord:=0, PatternMatch:=0, SoundsLike:=0, Format:=0, Wrap:=0 Wend ' Search and replace ² characters WordBasic.StartOfDocument WordBasic.StartOfLine WordBasic.EditFind Find:="ý", Direction:=0, MatchCase:=0, WholeWord:=0, PatternMatch:=0, SoundsLike:=0, Format:=0, Wrap:=0 While WordBasic.EditFindFound() Selection.InsertSymbol CharacterNumber:=178, Unicode:=True WordBasic.EditFind Find:="ý", Direction:=0, MatchCase:=0, WholeWord:=0, PatternMatch:=0, SoundsLike:=0, Format:=0, Wrap:=0 Wend WordBasic.FileSave WordBasic.FileClose WordBasic.FileOpen Name:="U:\Purchasing\Sean\Selectronic Purchase Order.doc", ConfirmConversions:=0, ReadOnly:=0, AddToMru:=0, PasswordDoc:="", PasswordDot:="", Revert:=0, WritePasswordDoc:="", WritePasswordDot:="" End Sub Last edited by Beatle13; 06-08-2017 at 01:22 AM. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word 2016 Won't Save. Keeps Asking to Save As, But Doesn't | CrossReach | Word | 3 | 03-11-2017 05:23 PM |
![]() |
rvessio | Word VBA | 4 | 07-25-2016 12:37 PM |
![]() |
brmveen | Word VBA | 2 | 11-04-2015 12:51 AM |
![]() |
samanthab | Word | 3 | 01-19-2013 06:27 AM |
Word ask to save template whenever i save a derived document | jorbjo | Word | 3 | 10-04-2012 10:52 AM |