VBScript doesn't work

S

Stefan

Hi all!

I am very new in designing Outlook Forms. However I designed my first form
including a CommandButton which should paste a text into a TextBox (I
programmed this function in the VBScript Editor). If I am working in the
Developer Mode and click on "Run This Form", the function works properly.
However if I open the form and directly click on the CommandButton (without
entering the Developer Mode and clicking Run This Form") or if I send the
Form, it doesn`t work anymore.
This is the Code I use:

Sub CommandButton2_Click()
Dim RequestID
Dim Tower
Dim Subject
Dim Datum

'get control items
Set RequestID = Item.GetInspector.ModifiedFormPages.Item("Request for
Change").Controls("RequestID")
Set Tower = Item.GetInspector.ModifiedFormPages.Item("Request for
Change").Controls("Tower")
Set Subject = Item.GetInspector.ModifiedFormPages.Item("Request for
Change").Controls("Subject")
Set Datum = Item.GetInspector.ModifiedFormPages.Item("Request for
Change").Controls("Datum")

RequestID.Value = "DE1-HBM02-IMS-" & Year(Date) & Month(Date) & Day(Date) &
Hour(Time) & Minute(Time)
Subject.Value = "Request for Change " & RequestID.Value & " " & "<" &
Tower.Value & ">"
Datum.Value = Day(Date) & "." & Month(Date) & "." & Year(Date)
End Sub

How can I make the CommandButton work ALWAYS????
 
S

Sue Mosher [MVP-Outlook]

Did you publish the form to your Personal Forms library? Code runs only on
published forms.
 

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