Office 2003
I've got a file thats created in excell which is to be loaded to a mainframe as a text file (tab delimited), but due to how excel sees the data it put speech marks in the file, i've created a macro within a word document to open the text file and remove them.
I've done some googling and I know that you can set an macro in excel to open a word doc and excute a macro from within it or have excel open a word document and manipulate it from within the excel macro.
Anyhow i've got as far as below but i keep getting debug errors on the lines in red. can anyone help
Sub manip()
Dim wdApp As Word.Application
Set wdApp = New Word.Application
wdApp.Visible = True
wdApp.Documents.Open Filename:="P:\IBM Calendar.doc"
With wdDoc
ChangeFileOpenDirectory "P:\"
Documents.Open Filename:="calpot.txt", ConfirmConversions:=False, AddToRecentFiles:=False, Format:=wdOpenFormatAuto
Windows("calpot").Activate
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = """"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End With
ActiveDocument.save
ActiveWindow.Close
Set wdApp = Nothing
End Sub
Bookmarks