I am getting a "Argument not optional" error when trying to compile my vba. New to programming, so not really sure why. Here is the function I set up:
Function esc(txt As String)
esc = Trim(Replace(txt, """, " \ ""))
End Function
when I run it, Replace get highlighted in blue. I am implementing a vba file from instructions online to send my excel data to mysql dbase on godaddy. here are the instructions i was given:
Once the ConnectDB Sub procedure is working, we will code the Sub procedure to perform data insertion. Before that, we need to create a data sanitizing function to escape single quotes before inserting them into the database. This is necessary because improper quote escaping will cause data insertion to fail.
Here are the codes for the esc function that will escape single quotes from data to be inserted:
Function esc(txt As String)
esc = Trim(Replace(txt, "'", "\'"))
End Function
Here is the site with the full code I am using:
http://www.heritage-tech.net/908/ins...cel-using-vba/
Bookmarks