P
pete the greek
hi im trying to us excel to log whick folders i access within my email and
> am
> struggling with the automation between outloook and excel
> i appear to be able to do this by creating a new excel object and then
> opening the excel file writing the info and then closing it again see code
> below.
> what i would like to do is leave the escel file open as i assume this
> would
> be quicker but if i do this creatobject opens the file as read only in the
> background
> i think i need to use getobject to pick up the open file but cant get it
> to
> work any pointers
> code:
> Sub log()
> Set MyApp = CreateObject("excel.application")
> Set objNS = Application.GetNamespace("MAPI")
> Set thisfolder = Application.ActiveExplorer.CurrentFolder
> MyApp.workbooks.Open "C:\Documents and Settings\Peter\My
> Documents\test.xls", ReadOnly:="false"
> MyApp.workbooks("test.xls").worksheets(1).Range("A1").Select
> MyApp.Selection.entirerow.Insert
> MyApp.workbooks("test.xls").worksheets(1).Range("A1").Value =
> thisfolder.Name
> MyApp.workbooks("test.xls").Close (True)
> End Sub
> am
> struggling with the automation between outloook and excel
> i appear to be able to do this by creating a new excel object and then
> opening the excel file writing the info and then closing it again see code
> below.
> what i would like to do is leave the escel file open as i assume this
> would
> be quicker but if i do this creatobject opens the file as read only in the
> background
> i think i need to use getobject to pick up the open file but cant get it
> to
> work any pointers
> code:
> Sub log()
> Set MyApp = CreateObject("excel.application")
> Set objNS = Application.GetNamespace("MAPI")
> Set thisfolder = Application.ActiveExplorer.CurrentFolder
> MyApp.workbooks.Open "C:\Documents and Settings\Peter\My
> Documents\test.xls", ReadOnly:="false"
> MyApp.workbooks("test.xls").worksheets(1).Range("A1").Select
> MyApp.Selection.entirerow.Insert
> MyApp.workbooks("test.xls").worksheets(1).Range("A1").Value =
> thisfolder.Name
> MyApp.workbooks("test.xls").Close (True)
> End Sub