M
Manoj Shah
I like to copy a block from word document and save as another word document naming person's account number document. If that file name is present then need to append in tnat document. I have made program but it gives error at .FileName = ![AccNo].doc. I don't know how to take input in to file name
' fileNewOld Macr
' Macro recorded 1/3/2004 by Manoj Sha
Selection.Cop
'Define patient's account numbe
Dim AccNo As Strin
AccNo = InputBox("Please write Account number", "Account Number"
'Find file with account number if 0, open new blank documen
Set fs = Application.FileSearc
With f
.LookIn = "C:\Documents and Settings\Manoj\My Documents\Manoj\
.FileName = ![AccNo].do
If .Execute = 0 The
Documents.Add DocumentType:=wdNewBlankDocumen
Selection.PasteAndFormat (wdPasteDefault
ActiveDocument.SaveAs FileName:=![AccNo].doc, FileFormat:=wdFormatDocument,
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False,
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=
Fals
WordBasic.EditOfficeClipboar
CommandBars("Task Pane").Visible = Fals
ActiveWindow.Clos
Els
Documents.Open FileName:=![AccNo].doc, ConfirmConversions:=False, ReadOnly:=
False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:=
"", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="",
Format:=wdOpenFormatAuto, XMLTransform:="
Selection.EndKey Unit:=wdStor
Selection.TypeParagrap
Selection.PasteAndFormat (wdPasteDefault
ActiveDocument.Sav
ActiveWindow.Clos
WordBasic.EditOfficeClipboar
CommandBars("Task Pane").Visible = Fals
End I
End Wit
Thank you
' fileNewOld Macr
' Macro recorded 1/3/2004 by Manoj Sha
Selection.Cop
'Define patient's account numbe
Dim AccNo As Strin
AccNo = InputBox("Please write Account number", "Account Number"
'Find file with account number if 0, open new blank documen
Set fs = Application.FileSearc
With f
.LookIn = "C:\Documents and Settings\Manoj\My Documents\Manoj\
.FileName = ![AccNo].do
If .Execute = 0 The
Documents.Add DocumentType:=wdNewBlankDocumen
Selection.PasteAndFormat (wdPasteDefault
ActiveDocument.SaveAs FileName:=![AccNo].doc, FileFormat:=wdFormatDocument,
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False,
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:=
Fals
WordBasic.EditOfficeClipboar
CommandBars("Task Pane").Visible = Fals
ActiveWindow.Clos
Els
Documents.Open FileName:=![AccNo].doc, ConfirmConversions:=False, ReadOnly:=
False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:=
"", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="",
Format:=wdOpenFormatAuto, XMLTransform:="
Selection.EndKey Unit:=wdStor
Selection.TypeParagrap
Selection.PasteAndFormat (wdPasteDefault
ActiveDocument.Sav
ActiveWindow.Clos
WordBasic.EditOfficeClipboar
CommandBars("Task Pane").Visible = Fals
End I
End Wit
Thank you