Results 1 to 8 of 8
  1. #1
    TOPSie is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    153

    "Compile Error: Method or data member not found"

    Perhaps it is just paranoia, but....



    I have an Access routine (Windows 10, Office 2016) which I have been running every month for several years.
    The routine examines the contents of an Outlook mailbox and reads the contents of the mail items and copies the contents to an Excel spread sheet.
    The relevant bit of the code is
    Code:
    Set appXL = CreateObject("Excel.Application")
    Set wb = appXL.Workbooks.Add
    Set ws = wb.Sheets("sheet1")
    ws.Select
    'DoCmd.Hourglass (True)
    i = 1
    
    For Each OutlookMail In TOPSFolder
     '@ Omitted @ 
                        ws.Cells(j, i) = TOPSLine
    
        Next
       i = i + 1
    Next OutlookMail
    
    wb.SaveAs "C:\xxxxx & ".xlsx"
    wb.Close
    This code has been working for years and I have not changed it recently.
    So I was surprised when today I got "Compile Error: Method or data member not found" and the line
    wb.SaveAs was iderntified as in error

    If I tried to rewrite the line then neither Save nor SaveAs was offered in the intellisense pane??

    As I had not changed anything my suspicions led to recent Windows updates.

    I uninstalled KB5059379 and the routine worked again

    So posting this as, perhaps, a warning to others.

    :-)

  2. #2
    jojowhite's Avatar
    jojowhite is online now Competent Performer
    Windows 11 Access 2021
    Join Date
    Jan 2025
    Posts
    434
    it has no Intellisense since you did not Declare All your variables.

    Dim appXL As Excel.Application
    Dim wb As Excel.Workbook
    Dim ws As Excel.Worksheet
    Dim i As Long

  3. #3
    TOPSie is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    153
    [QUOTE=jojowhite;533692]it has no Intellisense since you did not Declare All your variables.

    Maybe I used the wrong word. But after I had uninstalled the update SaveAs was offered as a valid Method - before uninstall it wasn't

    Click image for larger version. 

Name:	Clipboard_06-02-2025_01.jpg 
Views:	29 
Size:	8.3 KB 
ID:	53066

  4. #4
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Quote Originally Posted by jojowhite View Post
    it has no Intellisense since you did not Declare All your variables.
    How do you know that when he only posted part of the code?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    jojowhite's Avatar
    jojowhite is online now Competent Performer
    Windows 11 Access 2021
    Join Date
    Jan 2025
    Posts
    434
    Quote Originally Posted by Micron View Post
    How do you know that when he only posted part of the code?
    I know and I know you know as well that if you don't Declare, early bound an object, you don't get any intellisense.

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,559
    Quote Originally Posted by jojowhite View Post
    I know and I know you know as well that if you don't Declare, early bound an object, you don't get any intellisense.
    I think Micron meant that the O/P did not show all of the code?
    That always bugs me. You say you have not Dimmed the variables and then they come back with extra code to show they did.

    Why they can't do that in the first place is beyond me.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    jojowhite's Avatar
    jojowhite is online now Competent Performer
    Windows 11 Access 2021
    Join Date
    Jan 2025
    Posts
    434
    Quote Originally Posted by Welshgasman View Post
    I think Micron meant that the O/P did not show all of the code?
    That always bugs me. You say you have not Dimmed the variables and then they come back with extra code to show they did.

    Why they can't do that in the first place is beyond me.
    the OP only shows the code, right, a Late bound object (using CreateObject).
    so it is obvious he will not get any intellisense if he declared all variables as Object.

  8. #8
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    You're both right. I missed the late binding line because I skimmed over the code since most of it is missing.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 12-06-2019, 02:53 PM
  2. Replies: 3
    Last Post: 06-27-2014, 01:09 AM
  3. compile error method or data member not found???
    By chuman vishal in forum Programming
    Replies: 2
    Last Post: 02-26-2013, 01:57 PM
  4. Replies: 7
    Last Post: 06-08-2012, 09:55 PM
  5. Compile Error: Method or data member not found
    By subtilty in forum Programming
    Replies: 5
    Last Post: 02-09-2012, 07:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums