S
sebastico
Hello
In this forum Mr. Albert D. Kallal gently helped me with this piece of code
to paste .pdf files on DeskTop
Private SubtxtPath_Click()
Dim strDeskTop As String
'get path location to desktop
strDeskTop = CreateObject("Shell.Application").Namespace(&H10&).self.Path
FileCopy "C:\Belly\DataBase\Docs\" & Me.txtPath, strDeskTop & "\" & Me.txtPath
However, after clicking the button this messaged is displayed: Run-time
error '438':
Object doesn't support this property or method
When I open the vba it shows in yellow colour
FileCopy "C:\Belly\DataBase\Docs\" & Me.txtRuta, strDeskTop & "\" & Me.txtRuta
On the same way, in another forum Mr, Ruiz helped me with another code:
Option Compare Database
Option Explicit
Private Declare Function CopyFile Lib "kernel32.dll" Alias "Copy FileA"
(ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal
bFailIfExists As Long) As Long
Private Sub txtPath_Click()
On Error GoTo error
Dim retval As Long, pru1 As String, pru2 As String
Dim Nfso As Object
Dim Cpta As Object
Dim Arvos As Object
Dim Arvo As Object
Dim PathArvos As String
PathArvos = "C:\Belly\DataBase\Docs\"
Set Nfso = CreateObject("Scripting.FileSystemObject")
Set Cpta = Nfso.getFolder(PathArvos)
Set Arvos = Cpta.Files
For Each Arvo In Arvos
If Me.txtPath = Left(Arvo.Name, InStr(Arvo.Name, ".") - 1) Then
Debug.Print Arvo.Name
pru1 = Arvo
pru2 = "C:\Desktop\" & Arvo.Name '
retval = CopyFile(pru1, pru2, 1)
End If
Next
Set Arvos = Nothing
Set Cpta = Nothing
Set Nfso = Nothing
Sal:
Exit Sub
error:
MsgBox Err.Description
Resume Sal
End Sub
However, vba displays
The expression On Click you entered as the event property setting produced
the following error: Only comments may appear after End Sub, End Function,or
End Property.
Also I have another button with this code
Private Sub Command7_Click()
DoCmd.OpenForm "Pto"
DoCmd.Close acForm, Me.Name
End Sub
I am new to VBA programming and English is not my mother tongue. What does
these errors mean? I have heavily searched the help file and the web and have
not be able to find the answer. I hope I managed to explain my problem well...
Many thanks
In this forum Mr. Albert D. Kallal gently helped me with this piece of code
to paste .pdf files on DeskTop
Private SubtxtPath_Click()
Dim strDeskTop As String
'get path location to desktop
strDeskTop = CreateObject("Shell.Application").Namespace(&H10&).self.Path
FileCopy "C:\Belly\DataBase\Docs\" & Me.txtPath, strDeskTop & "\" & Me.txtPath
However, after clicking the button this messaged is displayed: Run-time
error '438':
Object doesn't support this property or method
When I open the vba it shows in yellow colour
FileCopy "C:\Belly\DataBase\Docs\" & Me.txtRuta, strDeskTop & "\" & Me.txtRuta
On the same way, in another forum Mr, Ruiz helped me with another code:
Option Compare Database
Option Explicit
Private Declare Function CopyFile Lib "kernel32.dll" Alias "Copy FileA"
(ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal
bFailIfExists As Long) As Long
Private Sub txtPath_Click()
On Error GoTo error
Dim retval As Long, pru1 As String, pru2 As String
Dim Nfso As Object
Dim Cpta As Object
Dim Arvos As Object
Dim Arvo As Object
Dim PathArvos As String
PathArvos = "C:\Belly\DataBase\Docs\"
Set Nfso = CreateObject("Scripting.FileSystemObject")
Set Cpta = Nfso.getFolder(PathArvos)
Set Arvos = Cpta.Files
For Each Arvo In Arvos
If Me.txtPath = Left(Arvo.Name, InStr(Arvo.Name, ".") - 1) Then
Debug.Print Arvo.Name
pru1 = Arvo
pru2 = "C:\Desktop\" & Arvo.Name '
retval = CopyFile(pru1, pru2, 1)
End If
Next
Set Arvos = Nothing
Set Cpta = Nothing
Set Nfso = Nothing
Sal:
Exit Sub
error:
MsgBox Err.Description
Resume Sal
End Sub
However, vba displays
The expression On Click you entered as the event property setting produced
the following error: Only comments may appear after End Sub, End Function,or
End Property.
Also I have another button with this code
Private Sub Command7_Click()
DoCmd.OpenForm "Pto"
DoCmd.Close acForm, Me.Name
End Sub
I am new to VBA programming and English is not my mother tongue. What does
these errors mean? I have heavily searched the help file and the web and have
not be able to find the answer. I hope I managed to explain my problem well...
Many thanks