Copying and pasting in a macro

D

Dudley

I have tried to create a macro to print to file. I typed the file name, then
recorded the macro to cut the name and write to file, pasting the text I had
cut as the file name. The problem was that the macro did not remember the
instructions to cut and paste. Can I get round this by editing the macro VBA
to insert instructions to cut and paste, and if so can anyone tell me what
the VBA code would be?

Thanks
Dudley
 
C

Chuck

Try using the print Dialog instead (look up Dialogs Collection Object in VBE
help - also look up "Built-in dialog box argument lists").

For instance the following will print to the file specified in the code.
There are other dialogs and arguments that you can use as listed in the
Built-in dialog box argument lists help topic.

With Dialogs(wdDialogFilePrint)
.PrToFileName = "c:\test\test.txt"
.PrintToFile = True
.Execute
End With
 
Top