gibbo1715
12-17-2007, 02:53 AM
Hi All
Been a while
I would like to make an image slide show using vba and call it from excel but im having problems with my code (Example below is me trying my hand at vbscript though), can anyone tell me what is wrong with this code please as i just get a blank ie screen and generate an error
thanks
gibbo
On Error Resume Next
Dim objFSO, oFO, oFolder, oFile, picDir, IE, Locus
Set objFSO = CreateObject("Scripting.FileSystemObject")
picDir = "C:\Documents and Settings\HP_Owner\Desktop\Slideshow\pics\"
Set oFolder = objFSO.GetFolder(picDir)
Set IE = CreateObject("InternetExplorer.Application")
IE.toolbar = false : IE.menubar = false : IE.statusbar = false : IE.Resizable = False
For Each oFile In oFolder.Files
If Right(oFile.Name,3) = "jpg" Or Right(oFile.Name,3) = "gif" Then
Locus = "file://" & Replace(oFile.ParentFolder,"\","/")&"/" & oFile.Name
With IE.document
.Open
.WriteLn "<HTML><HEAD>"
.WriteLn "<TITLE>HELLO!</TITLE></HEAD>"
.WriteLn "<BODY>"
.WriteLn "Hello world"
.WriteLn "<img src='" & Locus & "'><br>"
IE.Visible = True
WScript.Sleep 5000
.WriteLn "</BODY>"
.WriteLn "</HTML>"
.Close
End With
IE.Visible = True
WScript.Sleep 5000
End If
Next
Set IE = Nothing
Set objFSO = Nothing
Been a while
I would like to make an image slide show using vba and call it from excel but im having problems with my code (Example below is me trying my hand at vbscript though), can anyone tell me what is wrong with this code please as i just get a blank ie screen and generate an error
thanks
gibbo
On Error Resume Next
Dim objFSO, oFO, oFolder, oFile, picDir, IE, Locus
Set objFSO = CreateObject("Scripting.FileSystemObject")
picDir = "C:\Documents and Settings\HP_Owner\Desktop\Slideshow\pics\"
Set oFolder = objFSO.GetFolder(picDir)
Set IE = CreateObject("InternetExplorer.Application")
IE.toolbar = false : IE.menubar = false : IE.statusbar = false : IE.Resizable = False
For Each oFile In oFolder.Files
If Right(oFile.Name,3) = "jpg" Or Right(oFile.Name,3) = "gif" Then
Locus = "file://" & Replace(oFile.ParentFolder,"\","/")&"/" & oFile.Name
With IE.document
.Open
.WriteLn "<HTML><HEAD>"
.WriteLn "<TITLE>HELLO!</TITLE></HEAD>"
.WriteLn "<BODY>"
.WriteLn "Hello world"
.WriteLn "<img src='" & Locus & "'><br>"
IE.Visible = True
WScript.Sleep 5000
.WriteLn "</BODY>"
.WriteLn "</HTML>"
.Close
End With
IE.Visible = True
WScript.Sleep 5000
End If
Next
Set IE = Nothing
Set objFSO = Nothing