+ Reply to Thread
Results 1 to 4 of 4

Storing complex text string into variable. Text string contains html or xml code.

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-05-2015
    Location
    czech
    MS-Off Ver
    2010
    Posts
    172

    Storing complex text string into variable. Text string contains html or xml code.

    How do I store following string?

    MyString = "<?xml version = "1.0" encoding = "UTF-8"?>"

    It does not work.

    This works. Is it possible without escaping characters? Just with tags around the string?
    MyString = "<?xml version = ""1.0"" encoding = ""UTF-8""?>"
    Last edited by jakopak; 10-20-2015 at 02:55 AM.

  2. #2
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: Storing complex text string into variable. Text string contains html or xml code.

    Try this

    MyString = """<?xml version = """ & "1.0" & """ encoding = """ & "UTF-8""" & "?>"""
    Cheers!
    Deep Dave

  3. #3
    Forum Contributor
    Join Date
    02-05-2015
    Location
    czech
    MS-Off Ver
    2010
    Posts
    172

    Re: Storing complex text string into variable. Text string contains html or xml code.

    NeedForExcel, both codes bellow works. 2. code is more complex.

    1. jakopak
    MyString = "<?xml version = ""1.0"" encoding = ""UTF-8""?>"
    2.NeedForExcel
    MyString = """<?xml version = """ & "1.0" & """ encoding = """ & "UTF-8""" & "?>"""

    What I hope for is something like bellow. Using tag to wrap a string, so there is no need to add quotes in the middle of a string.
    MyString = <tag1><?xml version = "1.0" encoding = "UTF-8"?><tag1>

    The problem with the code 1. and 2. is, that if I write the string into file.xml, then the string is written exactly with added quotes. With added quotes the xml file is not working.

    EDIT:
    Solution
    command print prints string without added quotes.
    Last edited by jakopak; 10-20-2015 at 03:43 AM.

  4. #4
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: Storing complex text string into variable. Text string contains html or xml code.

    if I write the string into file.xm
    How are you writing it to a file?

+ 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. [SOLVED] Find partial text string within another text string return original text into cell.
    By mikey42979 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-17-2013, 02:58 PM
  2. [SOLVED] Extracting Text from a string of Text & Digits of variable length
    By hastex in forum Excel General
    Replies: 6
    Last Post: 06-06-2012, 09:11 AM
  3. Replies: 6
    Last Post: 03-08-2012, 10:35 AM
  4. Storing a text string based upon a 'listname'
    By shawfield in forum Excel General
    Replies: 1
    Last Post: 05-05-2011, 05:24 AM
  5. Write a string of text to all HTML files
    By tomlancaster in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-18-2010, 06:14 AM
  6. storing a string into a variable
    By reeceponse in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-29-2009, 12:16 PM
  7. [SOLVED] EXTRACT TEXT FROM TEXT STRING:The names are of variable length
    By carricka in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-08-2005, 06:05 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