+ Reply to Thread
Results 1 to 5 of 5

"Unable to get clean property of the Worksheetfunction Class"

Hybrid View

JasperD "Unable to get clean property... 10-29-2013, 05:13 AM
JosephP Re: "Unable to get clean... 10-29-2013, 05:19 AM
JasperD Re: "Unable to get clean... 10-29-2013, 05:37 AM
ragulduy Re: "Unable to get clean... 10-29-2013, 05:50 AM
JasperD Re: "Unable to get clean... 10-29-2013, 06:02 AM
  1. #1
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Unhappy "Unable to get clean property of the Worksheetfunction Class"

    Hi guys and girls,

    using a MSXML2.XMLHTTP method, I get a website responsetext that I store in a s:tring.
    This string (dimmed as "pres") contains crap like enters and tabs, that I want to remove by using the clean function.
    If I store the first 32000 characters of the string in a cell (due to cell length limitation only 32000 characters), then use
    presclean = Application.Worksheetfuction.Clean(Trim(Range("A1").Value)))
    it works fine.

    However, I need to use the clean/trim function without storing the responsetext to a cell first.
    If I do this :

    pres = pol.responsetext
    presclean = Application.WorksheetFunction.Clean(Trim(pres))
    it gives me an error : "Unable to get clean property of the Worksheetfunction Class" and I have no clue why.
    Any bright minds who could help me on this?

    Thank you so much in advance!
    Please click the * below if this helps

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: "Unable to get clean property of the Worksheetfunction Class"

    how many characters is pres?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: "Unable to get clean property of the Worksheetfunction Class"

    It varies each time when I get the website responsetext (it's product information, which is retrieved based on EAN code or part number).
    In the two example I'm trying to get to work, it's 52406 characters for one product and 76544 for the other....

  4. #4
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: "Unable to get clean property of the Worksheetfunction Class"

    I guess you need something like:
    for count = 1 to len(pres) step 32000
    presclean = presclean & application.worksheetfunction.clean(trim(mid(pres,count,32000)))
    next

  5. #5
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: "Unable to get clean property of the Worksheetfunction Class"

    Hi yudlugar,

    this works great, thank you - after seeing your solution I realized that I need to keep the character limitation in mind even though I don't actually do anything on the worksheet, I still use a WORKSHEET_FUNCTION.

    A bit silly of me to overlook it in the first place and thank you for helping me realize it !

    All the best,

    Jasper

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Error: "Unable to get the interior property of the range class."
    By wunderfisch in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-18-2013, 03:18 PM
  2. Replies: 6
    Last Post: 01-04-2013, 11:36 AM
  3. Error "Unable to set the Visible property of the PivotItem class"
    By Greg M in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-04-2010, 12:51 PM
  4. "Unable to set the Hidden property of the Range class" when unhiding cells
    By Kaigi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2009, 03:33 PM
  5. Replies: 2
    Last Post: 08-23-2006, 12:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1