And did you have a question? Newsgroups are good for getting answers to
specific questions, but aren't good for posting code and expecting someone
to test and solve problems without having the whole database application.
See
http://www.mvps.org/access/netiquette.htm for other good suggestions on
effective use of newsgroups.
Larry Linson
Microsoft Access MVP
"SAm" <(E-Mail Removed)> wrote in message
news:6F73B21D-3773-4A3D-952B-(E-Mail Removed)...
> Hi
>
> I have some code and i don't know why sometimes i get errors, sometimes i
> can get parts of it to work. the objective: run a report, save it as a
> word
> document, then copy it on to the clipboard, and delete the file. then i
> want
> to start a new excel spreadsheet, paste my clipboard in it, and save it.
> then
> i will add more code which is not written yet.
>
> this is the code:
>
> Code:
> Set MyWordInstance = New Word.Application
> MyWordInstance.Documents.Open "C:\tempRpt.rtf"
> With MyWordInstance
> .Selection.WholeStory
> .Selection.Find.ClearFormatting
> .Selection.Find.Replacement.ClearFormatting
> With .Selection.Find
> .Text = "^m"
> .Replacement.Text = ""
> .Forward = True
> End With
> .Selection.Find.Execute Replace:=wdReplaceAll
> .Selection.WholeStory
> .Selection.Copy
> End With
> MyWordInstance.ActiveDocument.Close
> MyWordInstance.Quit
> 'Kill "C:\tempPayperiodRpt.rtf"
>
> Set MyExcelInstance = New Excel.Application
> MyExcelInstance.Workbooks.Add
> MyExcelInstance.ActiveWorkbook.SaveAs "C:\PPP"
> MyExcelInstance.ActiveWorkbook.ActiveSheet.Range("B5").Select
> ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range("B5")
> MyExcelInstance.ActiveWorkbook.Save
> MyExcelInstance.ActiveWorkbook.Close
> MyExcelInstance.Quit