Macro doc + toolbar button via Email?

E

elle0612

Hi

I'm wondering if it is possible to Email a document with a macro attached,
to arrive at receiver complete with macro button on tool bar to run it.

I need to send someone the document and they don't know anything about
attaching buttons to macros.

Thanks
 
S

Summer

It seems neither do you! - The document needs to be xxxx.dot template with
the macro attached to the vbe editor ALT F11 and the toolbar copy using
Organizer and attached to the template document.

The receiver needs to save as xxxx.dot onto their desktop and then right
click NEW and create a copy which should with reference to the xxxx.dot
template you sent and the macros....

Hope this helps....
 
E

elle0612

Yes, I know most of that (not sure what Organizer is though).

Its true it was a document I sent not a template, but I was hoping the
document would open for the receiver without having to fiddle with trying to
attach buttons themselves.

This document was an example of something that will end up as a template in
the future, I didn't think I would have to do that at this stage.

thanks
 
E

elle0612

I have discovered a slight problem with this macro - this is the code, it is
meant to cut one selected table out whilst putting another in by means of an
assigned toolbar button.


Sub pastetable()

If Selection.Information(wdWithInTable) Then

Selection.Cut

ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=2,
NumColumns:= _
5, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
With Selection.Tables(1)
If .Style <> "Table Grid" Then
.Style = "Table Grid"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
End With
Selection.TypeText Text:="this"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="is"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="the"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="example"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="This"
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.MoveLeft Unit:=wdCharacter, Count:=4
Selection.TypeText Text:="is"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="example"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="of"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="macro"
Selection.MoveRight Unit:=wdCell
Selection.TypeText Text:="working"

Else
MsgBox "Please select a table."
End If

This is the error I am getting,

"The method or property is not available because the object is empty".

Now, if the cursor happens to be before or after the table, and the macro
button is pressed then the message box appears fine. But, if the cursor
happens to be in a table cell, and the macro button is pressed, then I get
the error message above. Any ideas how I can fix it.

Thanks


End Sub
 

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