8 Replies - 1369 Views - Last Post: 02 December 2011 - 12:39 PM Rate Topic: -----

#1 joeyward  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 16-November 11

Excel clean function in vb.net

Posted 02 December 2011 - 10:11 AM

I am trying to use an excel myclean function and receiving the error 'myClean' is not declared. It may be inaccessible due to its protection level. C:\Documents and Settings\jcward\My Documents\Visual Studio 2010\Projects\CLSHelpdesk\CLSHelpdesk\Form8.vb 32 33 CLSHelpdesk. I have added the reference to both Microsoft excel 12.0 object library as well as Microsoft excel 5.0 object library. Any help would be greatly appreciated.

Thank you

Is This A Good Question/Topic? 0
  • +

Replies To: Excel clean function in vb.net

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9094
  • View blog
  • Posts: 34,148
  • Joined: 12-June 08

Re: Excel clean function in vb.net

Posted 02 December 2011 - 10:21 AM

What's your code look like when you are trying to access the file?
Was This Post Helpful? 0
  • +
  • -

#3 joeyward  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 16-November 11

Re: Excel clean function in vb.net

Posted 02 December 2011 - 10:40 AM

I do not understand what file you are talking about? The String comes from access database that comes from Helpdesk ticket system. And need to remove any unprintable text. Just like Clean does in Excel.
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9094
  • View blog
  • Posts: 34,148
  • Joined: 12-June 08

Re: Excel clean function in vb.net

Posted 02 December 2011 - 10:50 AM

... okay so is "Form8.vb 32 33 CLSHelpdesk" a file you are creating or one your project is accessing?
Was This Post Helpful? 0
  • +
  • -

#5 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: Excel clean function in vb.net

Posted 02 December 2011 - 11:02 AM

this error looks to me like your variable "myClean" is not declared. you can however give us a little help and show us the code where you get this error
Was This Post Helpful? 0
  • +
  • -

#6 lattimer1999  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 8
  • Joined: 02-December 11

Re: Excel clean function in vb.net

Posted 02 December 2011 - 12:22 PM

If I'm reading your post right. See if the below will work.

Dim RegExStr As String = "<[^>]*>"

Dim Myclean As String = Regex.Replace([YourSting], RegExStr, "")


Then the Clean string will be Myclean.

Please let me if you need anymore help.
Was This Post Helpful? 1
  • +
  • -

#7 joeyward  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 16-November 11

Re: Excel clean function in vb.net

Posted 02 December 2011 - 12:28 PM

View Postlattimer1999, on 02 December 2011 - 12:22 PM, said:

If I'm reading your post right. See if the below will work.

Dim RegExStr As String = "<[^>]*>"

Dim Myclean As String = Regex.Replace([YourSting], RegExStr, "")


Then the Clean string will be Myclean.

Please let me if you need anymore help.


Works great except I also need to remove &nbsp.
Was This Post Helpful? 0
  • +
  • -

#8 lattimer1999  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 8
  • Joined: 02-December 11

Re: Excel clean function in vb.net

Posted 02 December 2011 - 12:32 PM

Use the below and it will remove that too.

Replace(Myclean, "&nbsp;", "")

Was This Post Helpful? 1
  • +
  • -

#9 joeyward  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 16-November 11

Re: Excel clean function in vb.net

Posted 02 December 2011 - 12:39 PM

View Postlattimer1999, on 02 December 2011 - 12:32 PM, said:

Use the below and it will remove that too.

Replace(Myclean, "&nbsp;", "")



Works like a charm.

Thanks for the help.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1