parameter to word xp macro

C

CJack

Hy,
I want to pass a string parament to a word macro' Document_Open()
event. I am using MS Word XP. my code goes here

Private Sub Document_Open(Param as string)
Dim Fs, flFile
Set Fs = CreateObject("Scripting.FileSystemObject")
Set flFile = Fs.CreateTextFile("c:\testfile", True)
flFile.WriteLine (Param)
flFile.Close
End Sub

When i open the document I am getting an error
"Procedure declaration does not match description of event or
procedure having the same name"

can anybody or somebody ::)) out there to help please

many thanks
 
B

Billy Ray

CJack said:
Hy,
I want to pass a string parament to a word macro' Document_Open()
event. I am using MS Word XP. my code goes here

Private Sub Document_Open(Param as string)
Dim Fs, flFile
Set Fs = CreateObject("Scripting.FileSystemObject")
Set flFile = Fs.CreateTextFile("c:\testfile", True)
flFile.WriteLine (Param)
flFile.Close
End Sub

When i open the document I am getting an error
"Procedure declaration does not match description of event or
procedure having the same name"

can anybody or somebody ::)) out there to help please

many thanks

You can't pass paramters to macros or Word events. Add a user form with
a text box to prompt the user for the text. Put code in Document_Open
to Show the form and get your text line.
 

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