PDA

View Full Version : Word Automation



brennaboy
09-24-2010, 04:43 AM
Hi,

Can someone help me with a mini-project.

I have a word doc/template where I change some details and then get my manager to sign before I fax off to a client.

What I would like to do is automate this process. So maybe something like I save the document with a command button and then send the link to my manager. He opens the word doc and clicks on the button which runs a macro to do the following:

1). Removes the command button and replaces it with a picture of his signature.

2). The doc autosaves

3). An E-Mail is sent back to me with the Word Doc on.

I think that I have the code for the E-Mail part, but I am unsure of how to write the code to replace the button once clicked with an image file.

Can anyone help me, or maybe there is a better way to do this with toobars for approval or something.

Can anyone help or offer advice?

Many thanks,

Bren.

Tinbendr
09-24-2010, 05:54 AM
Not fully tested, but how about using the Picture property of the command button to insert the signature.

So with a commandbutton on the document...
Private Sub CommandButton1_Click()
With CommandButton1
If .Picture = 0 Then
.Picture = "c:\my signature.jpg"
.BackColor = RGB(255, 255, 255)
End If
End With
End Sub

fumei
09-24-2010, 09:47 AM
Incorrect syntax. You need LoadPicture. I would also recommend using AutoSize, otherwise the image will be whatever size the commandbutton is. Also, unless you change it, the existing Caption will also be there.
Private Sub CommandButton1_Click()
With CommandButton1
If .Picture = 0 Then
.AutoSize = True
.Picture = LoadPicture("c:\my signature.jpg")
.Caption = ""
.BackColor = RGB(255, 255, 255)
End If
End With
End Sub