Problem:
While copying a cell which contains 'script' from Excel into another program, double-quotation marks ("") are added automatically instead of single-quotation mark only (").
Also, at the beginning and end of scripts, a " is automatically added.
Here is my script, and the emphasized quotes are the extraneous ones:
"// script to change budget by day of week // Jon Gritton 2016
// user vars var BUDG_NAME = " "Shared budget S104 (CX - High)" "; var B_MON = 500000 ; var B_TUE = 500000 ; var B_WED = 500000 ; var B_THU = 500000 ; var B_FRI = 500000 ; var B_SAT = 500000 ; var B_SUN = 500000 ;
function main() { setBudget(getBudgetToday()); }
function getBudgetToday() { var budgArray = [B_SUN,B_MON,B_TUE,B_WED,B_THU,B_FRI,B_SAT]; var d = new Date(Utilities.formatDate(new Date(), >AdWordsApp.currentAccount().getTimeZone(), " "MMM dd,yyyy HH:mm:ss" ")); var today = d.getDay(); return budgArray[today]; }
function setBudget(budgetToday) { Logger.log(" "Budget for today is: " " + budgetToday); var budgetIter = AdWordsApp.budgets() .withCondition(" "BudgetName = '" " + BUDG_NAME + " " ' " ") .get() while (budgetIter.hasNext()) { var thisBudget = budgetIter.next(); thisBudget.setAmount(budgetToday); } }"
Details:
I'm using Excel 2013 on Windows 10.
I've read on other thread that we can solve this by using this macro
Sub CopyCellContents()
'create a reference in the VBE to Microsft Forms 2.0 Lib
Dim objData As New DataObject
Dim strTemp As String
strTemp = ActiveCell.Value
objData.SetText (strTemp)
objData.PutInClipboard
End Sub
but apparently this macro is only compatible with Excel 2007, and not Excel 2013:
"Compile error: User-defined type not defined"
The only work-around is to copy the cell (that contains the script) into Word 2013 and copy the text through blocking the formula bar. But I need to just copy the cell to the new program.
How can I keep these double-quotes from showing up when copying to another program? In other words, can I get rid of these double quotation marks from being automatically added when the cell is copied to clipboard?
