Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi friends,
I am using below code for FTP using vbscript. Please help me to do same task via VBA. SystemUtil.run "cmd.exe" Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type "cd\" Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type micReturn Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type "ftp" Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type micReturn Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type "open mvsftp" Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type micReturn wait 1 Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type usrID " Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type micReturn Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type Password Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type micReturn Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type "get" Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type micReturn Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type "'"&dataset& "'" Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type micReturn Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type filePath Window("micclass:=Window","nativeclass:=ConsoleWin dowClass").Type micReturn Thanks & Regards |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sachin ahuja wrote:
I am using below code for FTP using vbscript. Please help me to do same task via VBA. It depends on what you actually want to do. If you want to specifically automate ftp, the best way is to use what amounts to a batch file: 'Untested air code... bakdir$ = CurDir$ ChDir "\" ftpf = FreeFile Open "ftpcmds.tmp" For Output As ftpf Print #ftpf, "open mvsftp" Print #ftpf, usrID & " 'No need to explicitly wait; ftp will worry about such things for you. Print #ftpf, Password Print #ftpf, "get" Print #ftpf, "'" & dataset & "'" Print #ftpf, filePath 'At this point, you may want to add an explicit exit to the batch: 'Print #ftpf, "bye" Close ftpf& Shell "ftp -s:ftpcmds.tmp" ChDir bakdir$ If you just need to grab files from an ftp server, you should be able to connect to it via code and grab your files directly. I'm sure there are plenty of examples for doing that on the www; Google is your friend. -- You can't turn the volume down on beating a hooker with a baseball bat. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wrote:
Close ftpf& Damn, missed one. Change "ftpf&" to "ftpf" in the above line. -- I take myself entirely too seriously. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am getting an error:
Run-time error '75' : Path/File access error at line : Open "ftpcmds.tmp" For Output As ftpf Please help me to resolve this problem. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sachin ahuja wrote:
I am getting an error: Run-time error '75' : Path/File access error at line : Open "ftpcmds.tmp" For Output As ftpf Please help me to resolve this problem. You probably don't have write access to the root directory. Change the code to this: bakdir$ = CurDir$ ChDir "\" tmpFile = Environ$("TEMP") & "\ftpcmds.tmp" ftpf = FreeFile Open tmpFile For Output As ftpf Print #ftpf, "open mvsftp" Print #ftpf, usrID & " 'No need to explicitly wait; ftp will worry about such things for you. Print #ftpf, Password Print #ftpf, "get" Print #ftpf, "'" & dataset & "'" Print #ftpf, filePath 'Without an exit, ftp will not automatically close. 'Print #ftpf, "bye" Close ftpf Shell "ftp -s:" & tmpFile ChDir bakdir$ Note that I haven't tested your ftp script, *just* the VBA code. -- Did the writers suffer a massive collective amnesia attack? |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Auric,
Its working fine now. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|