excel vba - Quotation Marks VBA -


i'm creating function inputs formula cell. keep on receiving syntax error. know due quotation marks. wondering how go including quotation marks of formula in function without causing syntax error.

any grateful.

sub codedump()         range("a1").value = "=dump(googleanalytics("ga:78770227", "ga:visits", "2014-05-28", "2014-06-26", "","", "", "", 500, false, false))"  end sub 

use escaping

for example, "" gives quotation mark. otherwise, use char codes

sub codedump()        range("a1").value = "=dump(googleanalytics(""ga:78770227"", ""ga:visits"", ""2014-05-28"", ""2014-06-26"", """","""", """", """", 500, false, false))"  end sub 

from http://msdn.microsoft.com/en-us/library/267k4fw5(v=vs.85).aspx

alternatives:

'escaping private sub insertquote()    textbox1.text = "she said, ""you deserve treat!"" " end sub  'character code private sub insertascii()    textbox1.text = "she said, " & chr(34) & "you deserve treat!" & chr(34) end sub  'defined string const quote string = """" textbox1.text = "she said, " & quote & "you deserve treat!" & quote 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -