Being a beginner at coding, I am trying to replace part of the code in my Python script using VBA. The challenge I face is that I need to replace 2 lines of code with nothing, and the VBA is not able to "find" these 2 lines in the code at all, which I think is because of the spaces, tabs in the python script. Below is the code that I have tried:
Attempt 1
strContents = Replace(strContents, "if time == 12:" & vbNewLine & vbTab & "Freq = 1", "") ***' THIS IS THE MOST CRUCIAL LINE - WHICH IS FAILING RIGHT NOW***
I am not adding the rest of the code of finding and replacing as it works seamlessly, and the issue is with being able to find this particular expression.
The python script I am trying to delete (or replace with nothing), looks like this:
if time == 12:
Freq = 1
else:
Freq = 12
In another attempt, I also tried counting the number of spaces, and asking the VBA to find the text in the python script with the number of spaces I could count in the script.
I may be missing something really basic - so please feel free to give your inputs. Your help would be greatly appreciated!
Many thanks in advance. :)