| | |
Formatted cell in excel
Thread Solved |
Hi,
I am wanting to get some data from an Excel spreadsheet. My problem is the data in the cell has been formatted.
i.e. This is sample text.
I want to be able to know which bits are made bold and create a string similar to: This is <b>sample<\b> text.
I canb get the text from the cell but lose the formatting.
Any ideas??
Happy New Year!
Pg
I am wanting to get some data from an Excel spreadsheet. My problem is the data in the cell has been formatted.
i.e. This is sample text.
I want to be able to know which bits are made bold and create a string similar to: This is <b>sample<\b> text.
I canb get the text from the cell but lose the formatting.
Any ideas??
Happy New Year!
Pg
Last edited by purplegerbil; Jan 5th, 2009 at 10:52 am.
purpleGERBIL
I worked out one solution - its a bit slow but works.
pG
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
myCell = "A3" OneChar = 0 With objWorksheet.Range(myCell) For i = 1 To .Characters.Count With .Characters(i, 1).Font ' Add the start tag <b> If .Bold = True And boldON = False Then FullRecord = FullRecord & "<b>" boldON = True End If ' Add the end tag <\b> If .Bold = False And boldON = True Then FullRecord = FullRecord & "<\b>" boldON = False End If End With ' Increment character counter OneChar = OneChar + 1 ' Add the character to the FullRecord variable FullRecord = FullRecord & Mid$(.Characters.Text, OneChar, 1) Next i ' If all the cell is bold then the end tag needs to be added If .Bold = True Then FullRecord = FullRecord & "<\b>" boldON = False End If End With
pG
purpleGERBIL
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Title in VB6 DATA REPORT
- Next Thread: using the mouse wheel in the Microsoft Visual Basic 6.0
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






