Ok here is how im accessing the files, and the looping. Basically looping the webpages, and hoping for the document complted code to fire after i navigate to each page. But isnt working like that.
Im running VS2005 forgot to mention that if that helps?
Thanks for the help!!
Code:Dim Temp As String = String.Empty Dim myExcel As Excel.Application Dim MyrowNum As Integer = 1 Dim i As Integer = 1 Dim Strpath As String Dim strfile, strdir, strdir2 As String Dim Wksht As Excel.Worksheet Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click myExcel = CType(CreateObject("Excel.Application"), Excel.Application) Dim Owb As Excel.Workbook = myExcel.Workbooks.Add() myExcel.Visible = True Wksht = DirectCast(myExcel.Sheets("Sheet1"), Excel.Worksheet) Strpath = "\\server\Intranet\Intranet\CAD Dept" For Each strdir In IO.Directory.GetFiles(Strpath, "*htm", IO.SearchOption.TopDirectoryOnly) wb.Navigate(strdir) Next End Sub Private Sub wb_DocumentComplete(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent) Handles wb.DocumentComplete Wksht = DirectCast(myExcel.Sheets("Sheet1"), Excel.Worksheet) For Each MyLink As mshtml.HTMLAnchorElement In GetCurrentWebDoc.links Temp &= i.ToString & ")" & Environment.NewLine Temp &= MyLink.href Dim MyFileArray As Object MyFileArray = Split(Temp, "/") Dim MyArrayCount As Integer MyArrayCount = UBound(MyFileArray) Dim MyLinkFile As String = Replace(MyFileArray(MyArrayCount), ".dwf", "") Wksht.Cells(MyrowNum, 8) = MyLinkFile i += 1 MyrowNum = MyrowNum + 1 Temp = "" Next End Sub




Reply With Quote