Buongiorno, nel passaggio dall'office 32 bit al 64 bit ho perso il controllo DataTimePicker che utilizzavo all'interno di una userform.
Come posso sostituire questo controllo e aggiornare anche il codice vba, che scriveva le date in determinate celle?
Per agevolarvi nell'aiuto che vi sto chiedendo posto il codice della Userform.
Option Explicit
Private blStop As Boolean
Private Sub UserForm_Activate()
Dim Md As Worksheet
Dim R As Long
Set Md = ActiveWorkbook.Sheets("MasterDetail")
blStop = True
With Md
cmbPolizze.Text = .Cells(2, 3).Value
blStop = False
cmbPolizze.List = ThisWorkbook.Sheets("Polizze"). _
Range("ListaPolizze").Value
R = ActiveCell.Row
If ActiveCell = "" Then
'dtDataEvento.Value = Date
CommandButton1.Caption = "Inserisci"
Else
'dtDataEvento.Value = .Cells(R, 2).Value
txtPremio = Md.Cells(R, 3)
txtAnnotazioni = .Cells(R, 4).Value
If Md.Cells(R, 5).HasFormula Then
txtDocumento = GetUrl(Md.Cells(R, 5).Formula)
Else
txtDocumento = .Cells(R, 5).Value
End If
CommandButton1.Caption = "Modifica"
End If
End With
End Sub
Private Sub cmbPolizze_Change()
Dim SH As Worksheet
Dim Rng As Range
If blStop Then
Exit Sub
End If
Set SH = ThisWorkbook.Sheets("Masterdetail")
Set Rng = SH.Range("C2")
Rng.Value = Me.cmbPolizze.Value
End Sub
Private Sub CommandButton1_Click()
Dim R As Long, PID As Long, j As Long
With ThisWorkbook.Sheets("Masterdetail")
MsgBox "Polizza # = " & .Range("C2").Value _
& vbNewLine & _
"Database # = " & .Range("E2").Text
End With
PID = ActiveWorkbook.Sheets("MasterDetail").Cells(2, 5)
If CommandButton1.Caption = "Inserisci" Then
R = ActiveWorkbook.Sheets("Eventi").Cells(2, 3).End(xlDown).Row + 1
ActiveWorkbook.Sheets("Eventi").Cells(R, 1) = ActiveWorkbook.Sheets("Eventi").Cells(R - 1, 1) + 1
Else
R = ActiveWorkbook.Sheets("Eventi").Range("$A$2:$A$5000").Find(ActiveWorkbook.Sheets("MasterDetail").Cells(ActiveCell.Row, 1), LookIn:=xlValues).Row
End If
'ActiveWorkbook.Sheets("Eventi").Cells(R, 2) = dtDataEvento
ActiveWorkbook.Sheets("Eventi").Cells(R, 2).NumberFormat = "m/d/yyyy"
ActiveWorkbook.Sheets("Eventi").Cells(R, 3) = PID
ActiveWorkbook.Sheets("Eventi").Cells(R, 4) = CDbl(txtPremio)
ActiveWorkbook.Sheets("Eventi").Cells(R, 5) = txtAnnotazioni
If txtDocumento <> "" Then
ActiveWorkbook.Sheets("Eventi").Cells(R, 6).Formula = "=HYPERLINK(""" & txtDocumento & """,""" & Dir(txtDocumento) & """)"
End If
' serve solo per far scattare il worksheet_change e aggiornare il masterdetail!!!
ActiveSheet.Cells(2, 3) = ActiveSheet.Cells(4, 3)
Unload Me
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub CommandButton3_Click()
Dim FN As String
FN = Application.GetOpenFilename("All files (*.*), *.*")
If FN = "Falso" Then Exit Sub
txtDocumento.Text = FN
End Sub
Private Sub CommandButton4_Click()
Dim R As Long, PID As Long, j As Long, Dummy$
PID = ActiveWorkbook.Sheets("MasterDetail").Cells(2, 5)
If MsgBox("Sei sicuro?", vbQuestion & vbYesNo, "Elimina riga") = vbYes Then
R = ActiveWorkbook.Sheets("Eventi").Range("$A$2:$A$5000").Find(ActiveWorkbook.Sheets("MasterDetail").Cells(ActiveCell.Row, 1), LookIn:=xlValues).Row
ActiveWorkbook.Sheets("Eventi").Select
Dummy$ = CStr(R) + ":" + CStr(R)
Rows(Dummy$).Select
Selection.Delete Shift:=xlUp
ActiveWorkbook.Sheets("MasterDetail").Select
' serve solo per far scattare il worksheet_change e aggiornare il masterdetail!!!
ActiveSheet.Cells(2, 3) = ActiveSheet.Cells(4, 3)
Unload Me
Else
End If
End Sub
Ringraziandovi anticipatamente per il vostro aiuto, porgo cordiali saluti a tutta la community.
F.Leggio