Access - JOSELO Ayuda otra vez

 
Vista:

JOSELO Ayuda otra vez

Publicado por Leonard (58 intervenciones) el 11/12/2007 17:19:52
Joselo cuenta con eso, bueno vuelvo a recurrir a ti,

sigo presentando el problema, en el primer sub selecciono el archivo y lo envío como registro a mi formulario, para luego llamarla en el siguiente sub (Dir_Archivo)


Private Sub Adjunto_Click()
Dim nombrearchivo As Variant
Dim fd As FileDialog

Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
If .Show = -1 Then
For Each nombrearchivo In .SelectedItems
MsgBox "The path is: " & nombrearchivo
Dir_Archivo = nombrearchivo
Next nombrearchivo

Else
End If
End With

End Sub
_-------------------------------------------------------------------------------
Private Sub Command20_Click()

Dim outApp As Outlook.Application
Dim outMail As Outlook.MailItem
Dim archattach As Outlook.Attachment

Set outApp = CreateObject("Outlook.Application")

Set outMail = outApp.CreateItem(olMailItem)

Dim para As Variant
Dim Concopia As Variant
Dim copiaoculta As Variant
Dim cuerpo As Variant
Dim TitMsg As Variant

Set para = Nothing
Set Concopia = Nothing
Set copiaoculta = Nothing
Set cuerpo = Nothing

Set para = To_Para
Set Concopia = CC_ConCopia
Set copiaoculta = CCO_CopiaOculta
Set TitMsg = Titulomsg1
Set cuerpo = Mensaje

If IsNull(para) Then
MsgBox ("Insertar Destinatario")
Exit Sub
Else
If IsNull(Concopia) Then
Concopia = ""
End If
If IsNull(copiaoculta) Then
copiaoculta = ""
End If
If IsNull(cuerpo) Then
MsgBox ("Insertar información del correo")
Exit Sub
End If

End If
If IsNull(TitMsg) Then
MsgBox ("Insertar tema del mensaje")
Exit Sub
End If

With outMail
.TO = para
.CC = Concopia
.BCC = copiaoculta
.Subject = TitMsg
.Body = cuerpo
.Attachments.Add Dir_Archivo ( aqui vuelvo a presentar el error )

End With

'
Set para = Nothing
Set Concopia = Nothing
Set copiaoculta = Nothing
Set cuerpo = Nothing
Set outMail = Nothing
Set outApp = Nothing

End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:JOSELO Ayuda otra vez

Publicado por JOSELO (8 intervenciones) el 11/12/2007 17:23:21
El problema que las variables no pasan de un Sub a otro Sub.

Para solucionarlo, lo que podés hacer es en el formulario crear un control que contenga el valor de Dir_Archivo, por ejemplo NombreFile, en el procedimiento Private Sub Adjunto_Click() escribis el código
me.NombreFile = nombrearchivo

Y en el procedimiento Private Sub Command20_Click()
With outMail
.TO = para
.CC = Concopia
.BCC = copiaoculta
.Subject = TitMsg
.Body = cuerpo
'.Attachments.Add Dir_Archivo ( aqui vuelvo a presentar el error )
Attachments.Add me.NombreFile
End With

fijate si funciona, si es OK, al control NombreFile le podés establecer la propiedad Visible = No, asi nadie se entera.

Exitos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:JOSELO Ayuda otra vez

Publicado por Leonard (58 intervenciones) el 11/12/2007 17:37:08
Joselo eso mi hice Dir_Archivo es un control del formulario y aun asi me sigue presentando el error ,

Esto me tiene el craneo roto, por no decir otras cosas jejeje.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar