I want to use excel VBA to edit a script file in python then to be run in ArcGis. First I'm open to any easier way but so far I'm having trouble making a multiple line script with my VBA sub!
& vbCrLf & doesn't work in the command Fileout.Write. When I open my script file everything is on the same line.
neither is & Char(34) & working.
Private Sub CommandButton4_Click()
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Dim path As String
path = Application.ActiveWorkbook.path
Dim Fileout As Object
Set Fileout = fso.CreateTextFile(path & "\" & "test2.py", True, True)
Fileout.Write "import arcpy & vbCrLf & lyr = arcpy.mapping.Layer( & Char(34) & limits & Char(34) &) & vbCrLf & lyr.visible = True & vbCrLf & arcpy.RefreshActiveView()'"
Fileout.Close
End Sub
import arcpy & vbCrLf & lyr = arcpy.mapping.Layer( & Char(34) & limits & Char(34) &) & vbCrLf & lyr.visible = True & vbCrLf & arcpy.RefreshActiveView()'because you've enclosed all that vba code in double quotes.