Word 2007 Macro

W

WSR

I'd like to copy and paste special unformatted text.

This is my code that does not work. Any suggestions are appreciated.

Sub PasteSpeciaUnformattedText()
'
' PasteSpeciaUnformattedText Macro
'
'
Selection.Collapse Direction:=wdCollapseStart
Selection.PasteSpecial DataType:=wdPasteText
End Sub




Thanks.

(B^>)-]=[
 
S

Stefan Blom

In what way doesn't the macro work? What do you expect it to do?

If you want code that behaves like a "normal" paste, with the exception that
the format is always unformatted text, use the following code:

Sub PasteSpeciaUnformattedText()
On Error Resume Next
Selection.PasteSpecial DataType:=wdPasteText
End Sub

The On Error statement prevents an error message if you run the macro when
the Windows clipboard is empty.
 
W

WSR

Stefan:

Thanks for the quick reply. Everytime I 've tried the use the macro I get
the following message

This message can appear if:

The macro was deleted from the template.

The template was not loaded or referenced in the Templates and Add-ins
command.

The macro was turned off by the macro security settings of your system.

If the macro security settings are not allowing the macro to run, you should
confirm the origin of the macro to be sure that it can be trusted (contact
the developer or the source for the macro). You can then temporarily enable
all macros by using the following procedure.

Click the Microsoft Office Button, click Word Options, and then click Trust
Center.

Click Macro Settings.

Under Macro Settings, click Enable all macros.

NOTE: Be sure to change this option back to its original setting after you
have run the macro.

If the macro is not accessible because the template is not loaded, click the
Microsoft Office Button, click Word Options, and then click Add-Ins. At the
bottom of the Add-Ins pane, select Templates from the Manage drop down list,
and then click Go. In the Templates and Add-ins dialog box, click either
Attach or Add. If the macro is not in the template, you may need to copy the
macro from one template to another. Click the Organizer button at the bottom
of the Templates and Add-ins dialog box to start the Organizer utility.

I've followed these steps but still no-go. I have another macro that works
fine that pastes special picture with the following code:

Sub PasteSpecialPicture()
'
' PasteSpecialPicture Macro
'
'
Selection.PasteSpecial DataType:=9
End Sub



THANKS AGAIN!!!!!





Stefan Blom said:
In what way doesn't the macro work? What do you expect it to do?

If you want code that behaves like a "normal" paste, with the exception
that the format is always unformatted text, use the following code:

Sub PasteSpeciaUnformattedText()
On Error Resume Next
Selection.PasteSpecial DataType:=wdPasteText
End Sub

The On Error statement prevents an error message if you run the macro when
the Windows clipboard is empty.

--
Stefan Blom
Microsoft Word MVP



WSR said:
I'd like to copy and paste special unformatted text.

This is my code that does not work. Any suggestions are appreciated.

Sub PasteSpeciaUnformattedText()
'
' PasteSpeciaUnformattedText Macro
'
'
Selection.Collapse Direction:=wdCollapseStart
Selection.PasteSpecial DataType:=wdPasteText
End Sub




Thanks.

(B^>)-]=[
 
S

Stefan Blom

You should be able to run the code if you save it in the Normal template.

--
Stefan Blom
Microsoft Word MVP



WSR said:
Stefan:

Thanks for the quick reply. Everytime I 've tried the use the macro I get
the following message

This message can appear if:

The macro was deleted from the template.

The template was not loaded or referenced in the Templates and Add-ins
command.

The macro was turned off by the macro security settings of your system.

If the macro security settings are not allowing the macro to run, you
should confirm the origin of the macro to be sure that it can be trusted
(contact the developer or the source for the macro). You can then
temporarily enable all macros by using the following procedure.

Click the Microsoft Office Button, click Word Options, and then click
Trust Center.

Click Macro Settings.

Under Macro Settings, click Enable all macros.

NOTE: Be sure to change this option back to its original setting after you
have run the macro.

If the macro is not accessible because the template is not loaded, click
the Microsoft Office Button, click Word Options, and then click Add-Ins.
At the bottom of the Add-Ins pane, select Templates from the Manage drop
down list, and then click Go. In the Templates and Add-ins dialog box,
click either Attach or Add. If the macro is not in the template, you may
need to copy the macro from one template to another. Click the Organizer
button at the bottom of the Templates and Add-ins dialog box to start the
Organizer utility.

I've followed these steps but still no-go. I have another macro that works
fine that pastes special picture with the following code:

Sub PasteSpecialPicture()
'
' PasteSpecialPicture Macro
'
'
Selection.PasteSpecial DataType:=9
End Sub



THANKS AGAIN!!!!!





Stefan Blom said:
In what way doesn't the macro work? What do you expect it to do?

If you want code that behaves like a "normal" paste, with the exception
that the format is always unformatted text, use the following code:

Sub PasteSpeciaUnformattedText()
On Error Resume Next
Selection.PasteSpecial DataType:=wdPasteText
End Sub

The On Error statement prevents an error message if you run the macro
when the Windows clipboard is empty.

--
Stefan Blom
Microsoft Word MVP



WSR said:
I'd like to copy and paste special unformatted text.

This is my code that does not work. Any suggestions are appreciated.

Sub PasteSpeciaUnformattedText()
'
' PasteSpeciaUnformattedText Macro
'
'
Selection.Collapse Direction:=wdCollapseStart
Selection.PasteSpecial DataType:=wdPasteText
End Sub




Thanks.

(B^>)-]=[
 
W

WSR

Thanks Stefan.

You got it to work for me.

Regards

(B^>)

Stefan Blom said:
You should be able to run the code if you save it in the Normal template.

--
Stefan Blom
Microsoft Word MVP



WSR said:
Stefan:

Thanks for the quick reply. Everytime I 've tried the use the macro I get
the following message

This message can appear if:

The macro was deleted from the template.

The template was not loaded or referenced in the Templates and Add-ins
command.

The macro was turned off by the macro security settings of your system.

If the macro security settings are not allowing the macro to run, you
should confirm the origin of the macro to be sure that it can be trusted
(contact the developer or the source for the macro). You can then
temporarily enable all macros by using the following procedure.

Click the Microsoft Office Button, click Word Options, and then click
Trust Center.

Click Macro Settings.

Under Macro Settings, click Enable all macros.

NOTE: Be sure to change this option back to its original setting after
you have run the macro.

If the macro is not accessible because the template is not loaded, click
the Microsoft Office Button, click Word Options, and then click Add-Ins.
At the bottom of the Add-Ins pane, select Templates from the Manage drop
down list, and then click Go. In the Templates and Add-ins dialog box,
click either Attach or Add. If the macro is not in the template, you may
need to copy the macro from one template to another. Click the Organizer
button at the bottom of the Templates and Add-ins dialog box to start the
Organizer utility.

I've followed these steps but still no-go. I have another macro that
works fine that pastes special picture with the following code:

Sub PasteSpecialPicture()
'
' PasteSpecialPicture Macro
'
'
Selection.PasteSpecial DataType:=9
End Sub



THANKS AGAIN!!!!!





Stefan Blom said:
In what way doesn't the macro work? What do you expect it to do?

If you want code that behaves like a "normal" paste, with the exception
that the format is always unformatted text, use the following code:

Sub PasteSpeciaUnformattedText()
On Error Resume Next
Selection.PasteSpecial DataType:=wdPasteText
End Sub

The On Error statement prevents an error message if you run the macro
when the Windows clipboard is empty.

--
Stefan Blom
Microsoft Word MVP



I'd like to copy and paste special unformatted text.

This is my code that does not work. Any suggestions are appreciated.

Sub PasteSpeciaUnformattedText()
'
' PasteSpeciaUnformattedText Macro
'
'
Selection.Collapse Direction:=wdCollapseStart
Selection.PasteSpecial DataType:=wdPasteText
End Sub




Thanks.

(B^>)-]=[
 
S

Stefan Blom

I'm glad I could help. :)

--
Stefan Blom
Microsoft Word MVP



WSR said:
Thanks Stefan.

You got it to work for me.

Regards

(B^>)

Stefan Blom said:
You should be able to run the code if you save it in the Normal template.

--
Stefan Blom
Microsoft Word MVP



WSR said:
Stefan:

Thanks for the quick reply. Everytime I 've tried the use the macro I
get the following message

This message can appear if:

The macro was deleted from the template.

The template was not loaded or referenced in the Templates and Add-ins
command.

The macro was turned off by the macro security settings of your system.

If the macro security settings are not allowing the macro to run, you
should confirm the origin of the macro to be sure that it can be trusted
(contact the developer or the source for the macro). You can then
temporarily enable all macros by using the following procedure.

Click the Microsoft Office Button, click Word Options, and then click
Trust Center.

Click Macro Settings.

Under Macro Settings, click Enable all macros.

NOTE: Be sure to change this option back to its original setting after
you have run the macro.

If the macro is not accessible because the template is not loaded, click
the Microsoft Office Button, click Word Options, and then click Add-Ins.
At the bottom of the Add-Ins pane, select Templates from the Manage drop
down list, and then click Go. In the Templates and Add-ins dialog box,
click either Attach or Add. If the macro is not in the template, you may
need to copy the macro from one template to another. Click the Organizer
button at the bottom of the Templates and Add-ins dialog box to start
the Organizer utility.

I've followed these steps but still no-go. I have another macro that
works fine that pastes special picture with the following code:

Sub PasteSpecialPicture()
'
' PasteSpecialPicture Macro
'
'
Selection.PasteSpecial DataType:=9
End Sub



THANKS AGAIN!!!!!





In what way doesn't the macro work? What do you expect it to do?

If you want code that behaves like a "normal" paste, with the exception
that the format is always unformatted text, use the following code:

Sub PasteSpeciaUnformattedText()
On Error Resume Next
Selection.PasteSpecial DataType:=wdPasteText
End Sub

The On Error statement prevents an error message if you run the macro
when the Windows clipboard is empty.

--
Stefan Blom
Microsoft Word MVP



I'd like to copy and paste special unformatted text.

This is my code that does not work. Any suggestions are appreciated.

Sub PasteSpeciaUnformattedText()
'
' PasteSpeciaUnformattedText Macro
'
'
Selection.Collapse Direction:=wdCollapseStart
Selection.PasteSpecial DataType:=wdPasteText
End Sub




Thanks.

(B^>)-]=[
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top