VALIDANDO COMBOBOX
Com o codigo abaixo carrego o combo para selecionar o tipo de impressora, quando ele carrega, carrega vazio. Gostaria de acrecentar na rotina do botão, CmdImprimir, se ele estiver vazio, ou seja, não ter sido selecionado nenhuma impressora retorna uma mensagem. é possivel essa ajuda?
Desde já agradeço.
With ComboImpressora
.Clear
.AddItem "HP Deskjet 840c - LogÃstica"
.AddItem "RICOH OfÃcio 1015 PCL - Arquivo"
End With
Private Sub CmdImprimir_Click()
Dim busca As String
If Op_Data.Value = False And Op_Codigo.Value = False And Op_Geral.Value = False Then
busca = MsgBox("é necessário selecionar uma das opções para acionar impressão.", vbInformation)
Else
Impressora
End If
Desde já agradeço.
With ComboImpressora
.Clear
.AddItem "HP Deskjet 840c - LogÃstica"
.AddItem "RICOH OfÃcio 1015 PCL - Arquivo"
End With
Private Sub CmdImprimir_Click()
Dim busca As String
If Op_Data.Value = False And Op_Codigo.Value = False And Op_Geral.Value = False Then
busca = MsgBox("é necessário selecionar uma das opções para acionar impressão.", vbInformation)
Else
Impressora
End If
Voce pode carregar o combo já com um valor
Combo1.listindex = 0 ou 1 ate combo1.listcount
ou faça isso
If Combo1.text = "" then
msgbox "Escolha uma impressora"
end if
Combo1.listindex = 0 ou 1 ate combo1.listcount
ou faça isso
If Combo1.text = "" then
msgbox "Escolha uma impressora"
end if
Não sei as funções dos optionbuttons , veja os teus IFs
Private Sub Impressora()
Dim busca1 As String
Dim Iprimir As String
If Op_Tela.Value = False And Op_Imp = False Then
busca1 = MsgBox("Marque uma das opções. Tela ou Impressora.", vbInformation)
End If
If Op_Imp.Value = True Then
If ComboImpressora.Text = "" Then
Imprimir = MsgBox("Selecione uma impressora.", vbInformation)
End If
Else <<<<<<< Como assim
Call Imprime_Geral1
Else <<<<<<< Como assim
FrmTela.Show
End If
End If
Private Sub Impressora()
Dim busca1 As String
Dim Iprimir As String
If Op_Tela.Value = False And Op_Imp = False Then
busca1 = MsgBox("Marque uma das opções. Tela ou Impressora.", vbInformation)
End If
If Op_Imp.Value = True Then
If ComboImpressora.Text = "" Then
Imprimir = MsgBox("Selecione uma impressora.", vbInformation)
End If
Else <<<<<<< Como assim
Call Imprime_Geral1
Else <<<<<<< Como assim
FrmTela.Show
End If
End If
Private Sub Impressora()
Dim busca1 As String
If Op_Tela.Value = False And Op_Imp = False Then
busca1 = MsgBox("Marque uma das opções. Tela ou Impressora.", vbInformation)
End If
If Op_Imp.Value = True Then
if combo.text > "" then
Call Imprime_Geral1>>>>>>Mando para impressora
else
msgbox "Selecione a impressora"
end if
Else
FrmTela.Show>>>>>Mando para Tela
End If
End Sub
Dim busca1 As String
If Op_Tela.Value = False And Op_Imp = False Then
busca1 = MsgBox("Marque uma das opções. Tela ou Impressora.", vbInformation)
End If
If Op_Imp.Value = True Then
if combo.text > "" then
Call Imprime_Geral1>>>>>>Mando para impressora
else
msgbox "Selecione a impressora"
end if
Else
FrmTela.Show>>>>>Mando para Tela
End If
End Sub
Tópico encerrado , respostas não são mais permitidas