Question : Can I have Code Created to Automate Input in Word & Excel?

I have to update Word & Excel docs every day with my: Name, Job title, current days date, and signed.

In both Word & Excel docs there are feilds (see attached screen prints) where I enter my name, my job title, current days date and there is a "sign" filed where I enter: "Via Email".

I have to enter this same data EVERY TIME I use these docs. And I go through about 20 of these docs a day. So as you can see, entering in that same data everyday has gotten old really qucik.

It would make my job so much easier if I had a macro button on my Word and Excell where when I clicked it, it just populated the feilds for me.

Is that possible?

Thanks.
Attachments:
 
 
 
 

Answer : Can I have Code Created to Automate Input in Word & Excel?

Ok, here you go for Word (my nightmare application)

Insert this macro in your normal.dot

Sub FillMeIn()
Dim wd As Document
Set wd = ActiveDocument
wd.Tables(1).Range.Cells(52).Range.Text = "John Burch"
wd.Tables(1).Range.Cells(54).Range.Text = "CNC Administrator"
wd.Tables(1).Range.Cells(56).Range.Text = Date
wd.Tables(1).Range.Cells(58).Range.Text = "Via Email"
End Sub

If you don't know how to do this, you can do this

In menu bar go to Tools/Macro --> Macro
Fill in "FillMeIn" in the Macro Name field
Click "Create"

You will now arrive in the VBA Editor (always accessible through Alt+F11) and see this on the right side

Sub GFGFG()
'
' GFGFG Macro
' Macro created 8/25/2010 by xxx
'

End Sub

now paste the code below between Sub() and End Sub

Dim wd As Document
Set wd = ActiveDocument
wd.Tables(1).Range.Cells(52).Range.Text = "John Burch"
wd.Tables(1).Range.Cells(54).Range.Text = "CNC Administrator"
wd.Tables(1).Range.Cells(56).Range.Text = Date
wd.Tables(1).Range.Cells(58).Range.Text = "Via Email"
End Sub

Now assign the macro to a shortcut key (say Alt+A)

In Word menu, go to Tools/Customize
In the bottom of the window, click the Customize button beside Close
In the Categories list (top Left), scroll down to Macros and select it
In the Macros list, select the just created FillMeIn
Select the field "Press new shortcut key"
Now press Alt+A and check it is copied in the the field "Press new shortcut key"
Click Assign
CLick close

Test it by launching it through alt + a
Random Solutions  
 
programming4us programming4us