A
avardaneg
I'm trying to find a way to copy files back and forth between my local disk
and a https:// network location that requires ID an password. After some
research through this forum I was able to find some pieces of code that
allowed me to save a file to the network via "Save As". The problem is that
I'd like to keep the same time stamp between the local file and its copy in
the network... I've tried FileCopy, Copyfile, etc... nothing seems to work
when I try to copy the file instead of doing "Save As". Any suggestions? Beow
you'll find the code I have so far:
Sub test2()
Dim source As String
Dim destination As String
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = False
.Navigate "https://myprotectedsite.com/"
Do Until .ReadyState = 4
DoEvents
Loop
Set ipf = .Document.all.Item("_ctl1:email")
If ipf Is Nothing Then GoTo skiplogin:
ipf.Value = "(e-mail address removed)"
Set ipf = .Document.all.Item("_ctl1assword")
ipf.Value = "mypwd"
Set ipf = .Document.all.Item("_ctl1:SigninBtn")
Do Until .ReadyState = 4
DoEvents
Loop
ipf.Click
Do Until .ReadyState = 4
DoEvents
Loop
End With
skiplogin:
source = "C:\Mylocalfolder\test.xls"
destination = "https://myprotectedsite.com/test.xls"
FileCopy source, destination ' ->>> Run time error 52 - Bad file name or
number
ie.Quit
End Sub
and a https:// network location that requires ID an password. After some
research through this forum I was able to find some pieces of code that
allowed me to save a file to the network via "Save As". The problem is that
I'd like to keep the same time stamp between the local file and its copy in
the network... I've tried FileCopy, Copyfile, etc... nothing seems to work
when I try to copy the file instead of doing "Save As". Any suggestions? Beow
you'll find the code I have so far:
Sub test2()
Dim source As String
Dim destination As String
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = False
.Navigate "https://myprotectedsite.com/"
Do Until .ReadyState = 4
DoEvents
Loop
Set ipf = .Document.all.Item("_ctl1:email")
If ipf Is Nothing Then GoTo skiplogin:
ipf.Value = "(e-mail address removed)"
Set ipf = .Document.all.Item("_ctl1assword")
ipf.Value = "mypwd"
Set ipf = .Document.all.Item("_ctl1:SigninBtn")
Do Until .ReadyState = 4
DoEvents
Loop
ipf.Click
Do Until .ReadyState = 4
DoEvents
Loop
End With
skiplogin:
source = "C:\Mylocalfolder\test.xls"
destination = "https://myprotectedsite.com/test.xls"
FileCopy source, destination ' ->>> Run time error 52 - Bad file name or
number
ie.Quit
End Sub