|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Macro to Print Text to file in UTF-8I am trying to print the value of a cell in Excel to a file "temp.html". The button's macro looks like this: Sub Text() Dim i As Long Open "c:\temp\Homepage.html" For Output As #1 For i = 1 To Selection.Cells.Count Print #1, Selection.Cells(i).Value Next i Close 1 End Sub I need to know what to add to this code so that the file is created as UTF-8 encoding. I am trying to preserve foreign characters, and currently they are all being saved as "???????????". Thanks! "jakeatkins via VBMonster.com" <u35973@uwe> wrote in message news:97b2bf58dbec7@uwe...> I am trying to print the value of a cell in Excel to a file "temp.html". You'd be better served asking in microsoft.public.excel.programming. This > The > button's macro looks like this: group is for full-blown Visual Basic. Jeff Johnson wrote:
>> I am trying to print the value of a cell in Excel to a file "temp.html". Post answers here:>> The >> button's macro looks like this: > >You'd be better served asking in microsoft.public.excel.programming. This >group is for full-blown Visual Basic. http://www.officekb.com/Uwe/Forum.aspx/excel-prog/153933/Macro-to-Print-Text-to-file-in-UTF-8 "jakeatkins via VBMonster.com" <u35973@uwe> wrote in message news:97b345f50ed6a@uwe... You telling us where to answer you at? I don't think so. That's not how newsgroups work.> Jeff Johnson wrote: >>> I am trying to print the value of a cell in Excel to a file "temp.html". >>> The >>> button's macro looks like this: >> >>You'd be better served asking in microsoft.public.excel.programming. This >>group is for full-blown Visual Basic. > > Post answers here: > http://www.officekb.com/Uwe/Forum.aspx/excel-prog/153933/Macro-to-Print-Text-to-file-in-UTF-8 > You better read up on newsgroup ettiquette before you make any more posts! -- Mike MikeD wrote:
>>>> I am trying to print the value of a cell in Excel to a file "temp.html". I frankly don't care where you post your answers at. I was simply following>>>> The >[quoted text clipped - 5 lines] >> Post answers here: >> http://www.officekb.com/Uwe/Forum.aspx/excel-prog/153933/Macro-to-Print-Text-to-file-in-UTF-8 > >You telling us where to answer you at? I don't think so. That's not how newsgroups work. > >You better read up on newsgroup ettiquette before you make any more posts! > the previous poster's suggestion to move it elsewhere. I was following common forum ettiquette by showing where this post was now continuing (in it's proper forum). If anyone else was looking for the answer here, like I was, they could find where I moved it. Someone needs to seriously chill out... "jakeatkins via VBMonster.com" <u35973@uwe> wrote in message news:97b3f87d72705@uwe...> I frankly don't care where you post your answers at. I was simply And you need to proofread. "Post answers at" can easily be interpreted as a > following > the previous poster's suggestion to move it elsewhere. I was following > common forum ettiquette by showing where this post was now continuing (in > it's proper forum). If anyone else was looking for the answer here, like > I > was, they could find where I moved it. > > Someone needs to seriously chill out... command in English. It's certainly how I read it, and I was ready to respond like Mike did. An unambiguous statement would have been either "Answers posted at" or "Discussion continues at." "jakeatkins via VBMonster.com" <u35973@uwe> wrote in message news:97b2bf58dbec7@uwe...Show quoteHide quote > Hello, Whether VB6 or VBA you should be able to use something like:> > I am trying to print the value of a cell in Excel to a file "temp.html". > The > button's macro looks like this: > > Sub Text() > Dim i As Long > Open "c:\temp\Homepage.html" For Output As #1 > For i = 1 To Selection.Cells.Count > Print #1, Selection.Cells(i).Value > Next i > Close 1 > End Sub > > I need to know what to add to this code so that the file is created as > UTF-8 > encoding. I am trying to preserve foreign characters, and currently they > are > all being saved as "???????????". > > Thanks! 'Reference to ADO 2.5 or later. Dim stmUTF8 As ADODB.Stream Dim I As Integer Set stmUTF8 = New ADODB.Stream With stmUTF8 .Open .Type = adTypeText .Charset = "utf-8" .LineSeparator = adLF For I = 1 To 10 .WriteText CStr(I), adWriteLine Next .SaveToFile "C:\temp\somefile.htm", adSaveCreateOverWrite .Close End With This example creates a file of 10 lines containing 1 through 10, in UTF-8 format using LF as the line delimiter. Untested "air code" though.
Download multiple files concurrently using WinHttpRequest
When the compiler freezes.... what is the rescue? How to Change $(AppPath) in PDWizard? Karl, I need to understand your Timer! Run-Time Error 5 - 'Invalid procedure call or argument' error msg Overcoming a MsgBox's shyness File not found How to obtain the new GUIID key on a new build of an ActiveX DLL or an ActiveX OCX Autosize DataGrid Columns JPEG File Compression |
|||||||||||||||||||||||