PDA

View Full Version : (Visual Basic )Programma che non gira


mariade
23-02-2006, 12:50
Salve ragazzi ho ricevuto un compito molto semplice dal mio prof da scrivere in Visual Basic. Ora io il compito chedo di averlo svolto ma non so come farlo girare..Il compito e' creare e' il seguente allegato nel file e io ho scritto il codice seguente.Qualcuno sa dirmi dove sbaglio e come farlo girare per vedere se funziona?


Private Sub cmdOK_Click()
chkBold.Value = True
chkUnderline.Value = True
Dim txtText As String
Dim optColour As Boolean

If optRed = True Then optColour = True
If optGreen = True Then optColour = True
If optBlue = True Then optColour = True

End If

Application.ScreenUpdating = False
With ActiveDocument
.Bookmarks("RecipientName").Range.Text = txtRecipienName.Value
.Bookmarks("RecipientAddress").Range.Text = txtRecipientAddress.Value
.Bookmarks("Salutation").Range.Text = txt.Salutation.Value
.Bookmarks("Position").Range.Text = txtPosition.Value
.Bookmarks("InterviewLocation").Range.Text = cboInterviewLocation.Value
.Bookmarks("interviewDay").Range.Text = cboInterviewDay.Value
.Bookmarks("InterviewDate").Range.Text = txtInterviewDate.Value
.Bookmarks("InterviewTime").Range.Text = txtInterviewTime.Value
.Bookmarks("InterviewDuration").Range.Text = cboInterviewDuration.Value
.Bookmarks("Greeting").Range.Text = strGreeting
.Bookmarks("SenderName").Range.Text = txtSenderName.Value
.Bookmarks("SenderPosition").Range.Text = txtSenderPosition.Value
.Bookmarks("SenderAddress").Range.Text = StrSenderAddress
End With
Application.ScreenUpdating = True
Unload Me
End Sub

Private Sub cmdQuit_Click()
Unload Me
ActiveDocument.Close SaveChanges:=False

End Sub

Private Sub UserForm_Initialize()
optColour.Value = True
With cmbBookmark
.AddItem "RecipientName"
.AddItem "RecipientAddress"
.AddItem "Salutation"
.AddItem "Position"
.AddItem "InterviewLocation"
.AddItem "InterviewDay"
.AddItem "InterviewDate"
.AddItem "InterviewTime"
.AddItem "InterviewDuration"
.AddItem "Greeting"
.AddItem "SenderName"
.AddItem "SenderPosition"
.AddItem "SenderAddress"
End With
With cmbFont
.AddItem "Arial"
.AddItem "Courier"
.AddItem "Times New Roman"
.AddItem "Verdana"
End With

End Sub