Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Excel Macro error

Hi,


We have macro to extract the subject line from outlook mail folders..


It used to work ok..But for some reason now it errors out on this
line:


*Set ns = Application.Session*


iGrandRow = 2


Set wsCsd = wb.Worksheets(Tabnum1)


And here is the error messege:


“Object doesn’t support this property or method (Error 438)”


We have only this references :


Visual basic for application


Ms Excel 11:0 Object library


OLE Automation


Ms Office 11:0 object library


Outlook 11:00 object library..


Please let me know if we are missing any other object..


Thanks in advance.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Excel Macro error


This line is wrong:

Set ns = Application.Session*

this line will vary depending on the Host (Oulook or Excel)


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Excel Macro error

On Jul 29, 2:44*am, Javed wrote:
This line is wrong:

Set ns = Application.Session*

this line will vary depending on the Host (Oulook *or Excel)


Javed,
The host is excel in our case...Pls suggest the changes.
Thanks
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Excel Macro error

Sub MailSubj()

Dim ns As Namespace, ol As New Outlook.Application, mi As MailItem, FL
As Outlook.Folder
Dim i As Long

Set ns = ol.GetNamespace("MAPI")

'Prompts for selecting mail folder
Set FL = ns.PickFolder

i = 0

'adds sheet fro recording data
Worksheets.Add

'looping for getting subject of each mail

For Each mi In FL.Items
i = i + 1
Cells(i, 1).Value = mi.Subject
Next mi

End Sub
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Excel Macro error

On Jul 30, 9:09*am, Javed wrote:
Sub MailSubj()

Dim ns As Namespace, ol As New Outlook.Application, mi As MailItem, FL
As Outlook.Folder
Dim i As Long

Set ns = ol.GetNamespace("MAPI")

'Prompts for selecting mail folder
Set FL = ns.PickFolder

i = 0

'adds sheet fro recording data
Worksheets.Add

'looping for getting subject of each mail

For Each mi In FL.Items
* * i = i + 1
* * Cells(i, 1).Value = mi.Subject
Next mi

End Sub


Thanlks..
Here is the actual code...
Sub patron_RetrieveData()

Dim ns As Outlook.NameSpace
Dim fld As Outlook.MAPIFolder
Dim itm As Object
Dim msg As Outlook.MailItem
Dim ex As Excel.Application
Dim filePreMD As String, fileCurMD As String, fileSupport As
String
Dim wb As Excel.Workbook, wbSupport As Excel.Workbook
Dim ws As Excel.Worksheet, wsCsd As Excel.Worksheet
Dim iRow As Integer, iGrandRow As Integer

Dim curMon As String, strMonInFolder As String, curDate As Date
Dim arrFd() As String
Dim iFd As Integer
Dim NewSbj As allFinal

Dim arrType() As String

'On Error Resume Next
'
curMon = InputBox("Current Month, YYMM", "Month",
Format(DateAdd("m", -1, Now), "YYMM"))
If CheckYYMM(curMon) = False Then MsgBox "Involid format of month.
Please check and run it again.", vbCritical + vbOKCancel, "Materdata":
Exit Sub
strMonInFolder = InputBox("Current month used in folders' names",
"Month", Format(DateAdd("m", -1, Now), "mmmm"))
Set ex = CreateObject("Excel.Application")
filePreMD = ex.GetOpenFilename("Excel Files (*.xls), *.xls", ,
"Last Month's patron file (to be used as the template)")
If filePreMD = "False" Then Exit Sub
Set wb = ex.Workbooks.Open(filePreMD, 0, True)
fileCurMD = ex.GetSaveAsFilename("", "Excel Files (*.xls),
*.xls", , "This Month's patron file (will be created if doesn't
exist)")
If fileCurMD = "False" Then Exit Sub
wb.SaveAs fileCurMD

fileSupport = ex.GetOpenFilename("Excel Files (*.xls), *.xls", ,
"Support file that contains both data tab and result tab")
If fileSupport = "False" Then Exit Sub

ex.Visible = True
ex.WindowState = xlMinimized
CleanupAndReset wb
arrType = Split(VolidType, ";")
' arrExclType = Split(ExcludedType, ";")

Set ns = Application.Session ' ################ERROR start
here###############
iGrandRow = 2
Set wsCsd = wb.Worksheets(TabConsld)



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Excel Macro error

On Jul 30, 6:36*pm, dii jii wrote:
On Jul 30, 9:09*am, Javed wrote:





Sub MailSubj()


Dim ns As Namespace, ol As New Outlook.Application, mi As MailItem, FL
As Outlook.Folder
Dim i As Long


Set ns = ol.GetNamespace("MAPI")


'Prompts for selecting mail folder
Set FL = ns.PickFolder


i = 0


'adds sheet fro recording data
Worksheets.Add


'looping for getting subject of each mail


For Each mi In FL.Items
* * i = i + 1
* * Cells(i, 1).Value = mi.Subject
Next mi


End Sub


Thanlks..
Here is the actual code...
Sub patron_RetrieveData()

* * Dim ns As Outlook.NameSpace
* * Dim fld As Outlook.MAPIFolder
* * Dim itm As Object
* * Dim msg As Outlook.MailItem
* * Dim ex As Excel.Application
* * Dim filePreMD As String, fileCurMD As String, fileSupport As
String
* * Dim wb As Excel.Workbook, wbSupport As Excel.Workbook
* * Dim ws As Excel.Worksheet, wsCsd As Excel.Worksheet
* * Dim iRow As Integer, iGrandRow As Integer

* * Dim curMon As String, strMonInFolder As String, curDate As Date
* * Dim arrFd() As String
* * Dim iFd As Integer
* * Dim NewSbj As allFinal

* * Dim arrType() As String

* * 'On Error Resume Next
* * '
* * curMon = InputBox("Current Month, YYMM", "Month",
Format(DateAdd("m", -1, Now), "YYMM"))
* * If CheckYYMM(curMon) = False Then MsgBox "Involid format of month.
Please check and run it again.", vbCritical + vbOKCancel, "Materdata":
Exit Sub
* * strMonInFolder = InputBox("Current month used in folders' names",
"Month", Format(DateAdd("m", -1, Now), "mmmm"))
* * Set ex = CreateObject("Excel.Application")
* * filePreMD = ex.GetOpenFilename("Excel Files (*.xls), *.xls", ,
"Last Month's patron file (to be used as the template)")
* * If filePreMD = "False" Then Exit Sub
* * Set wb = ex.Workbooks.Open(filePreMD, 0, True)
* * fileCurMD = ex.GetSaveAsFilename("", "Excel Files (*.xls),
*.xls", , "This Month's patron file (will be created if doesn't
exist)")
* * If fileCurMD = "False" Then Exit Sub
* * wb.SaveAs fileCurMD

* * fileSupport = ex.GetOpenFilename("Excel Files (*.xls), *.xls", ,
"Support file that contains both data tab and *result tab")
* * If fileSupport = "False" Then Exit Sub

* * ex.Visible = True
* * ex.WindowState = xlMinimized
* * CleanupAndReset wb
* * arrType = Split(VolidType, ";")
' * *arrExclType = Split(ExcludedType, ";")

* * Set ns = Application.Session *' ################ERROR start
here###############
* * iGrandRow = 2
* * Set wsCsd = wb.Worksheets(TabConsld)- Hide quoted text -

- Show quoted text -


Dear It is not clear whether problem solved or not.As you have put
code do you want me to update accordingly ?
However it seems that the code is half.Can you give full code.

I feel that you can incorporate necessary changes.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Programming 0 May 3rd 08 01:03 AM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Macro 'Automation error' with ChemOffice Excel macro Stew Excel Programming 0 October 27th 03 08:26 PM


All times are GMT +1. The time now is 05:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"