Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy Image File from WebService XML

Status
Not open for further replies.
Dec 6, 2001
67
0
0
JM
I am trying to extract certain elements from a weather webservice. To complete the picture I would like to copy the relevant icon from "c:\weather\" to the appropriate folder, ("c:\weather\BigImage\BigImage.png" ) based on information extracted from the retrieved XML file.

I use a "c:\weather\" main folder containing the Yahoo Weather icons; for example "21d.png" represents a particular icon. I would like to copy "21d.png" to "c:\weather\BigImage\" and rename it "BigImage.png"

The code below is adapted from a post I saw somewhere, but its generating an error:



Dim objFSO, strFilePath, strFileDestination
Dim BigImage, objFile

BigImage = "21"
StrFilePath = "c:\weather\" & BigImage & "d.png"
StrFileDestination = "c:\weather\BigImage\BigImage.png"


Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.CopyFile(StrFilePath,StrFileDestination, True)


What am I doing wrong?
 
Use simply this:
objFSO.CopyFile strFilePath, strFileDestination, True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
When I remove the brackets, I get the following
error Code: 800A0035
Error:File not found

Microsoft says:
This error occurs because FileSystemObject cannot find the file that is being accessed (through the OpenTextFile, DeleteFile, or CopyFile methods, for example). This typically occurs for two reasons:
• The file does not exist.
• FileSystemObject is not looking for the file in the folder that you had expected. By default, if you do not specify a path, FileSystemObject searches the WinNT\System32 folder.


c:\weather contains the weather icons,the "BigImage" folder and the text files I am reading from so I am not sure what is going on...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top