Multiple functions with same name in vba self duplicating - excel

I found some code here Generating 2D (PDF417 or QR) barcodes using Excel VBA by Jonas Heilderberg. When I try to run Call RenderQRCode("Sheet1", "A13", "QR Value") I get an "ambiguous name detected: RenderQRCode" error.
Can anyone help and tell me where Call RenderQRCode("Sheet1", "A13", "QR Value") should be getting placed and how it should be called?
Thanks in advance

Related

How to solve run time error method failed?

I'm trying to run a piece of code in vba but I'm still getting this error whenever I try to run it.
When I use debug the cursor on top of the 2nd line says "partDocument1 = Nothing"
Here's the code:
Set partDocument1 = documents1.item(Right(activeComponentWorksheet.cells(R, tem).Value, nameLength))
Set part1 = partDocument1.Part
Set body1 = part1.Bodies.item("PartBody")
selection1.Add body1
I'm just trying to create a part from the excel values by using macros. Could anyone explain why would this error happen?
This error message "Run time error method failed" is a general error message that can occur for a variety of reasons in VBA. It typically indicates that an operation that the code is trying to perform has failed, but without more information about the error and the specific line of code that is causing the issue, it is difficult to determine the exact cause of the problem.
One possible cause of this error in the provided code snippet is that the documents1.item(Right(activeComponentWorksheet.cells(R, tem).Value, nameLength)) method call is returning Nothing. This means that the item being passed as the argument to the method is not found in the documents1 collection. This will cause the subsequent Set part1 = partDocument1.Part and Set body1 = part1.Bodies.item("PartBody") line of code to throw the "Run time error method failed" error.
You can try to debug the error by adding some debug information and check if the variable partDocument1 is not equal to nothing before the error is thrown.
If partDocument1 Is Nothing Then
Debug.Print "partDocument1 is not found"
End If
You can also try to check if the value of the Right(activeComponentWorksheet.cells(R, tem).Value, nameLength) is matching with the value that you are expecting.
It's also possible that the problem is related to the activeComponentWorksheet.cells(R, tem).Value cell value or with the nameLength variable, it may be referencing a non-existent cell or it may contain a value that is not expected.
It's also possible that the problem is with the Bodies.item("PartBody") method, it may be that the body is not present or the name passed to the method is not correct.
These are some possible causes of the problem, but without more information about the specific environment and configuration of the code, it is difficult to provide a more specific solution.

Blue Prism expression to get most recent file from folder

I am trying to write an expression on putting an attachment in the Outlook VBO and keep getting error that it cant find the file.
The file name is Investment Value_2022-12-13h12m37s45.xlsx bit everything after value will be different.
I have tried writing it as a wild card.
"C:\Users\AAPWP\Downloads\Investment*"
I tried filtering it into its own collection and getting it that way.
"File.File"
Trying to get the file path from a filtered collection.
"Attachment.Folder.Name"
Anybody having the same issue and any help would be appreciated.
Use 'Utility - File Mangement: Get Files' action to get all excel files
Loop through each file name and use 'Decision' action to check for file name pattern
Use formula - InStr([Files.Name], "Investment Value_") > 0
If True, then thats the file you need

why is pycharm giving 'end of statement expected ' error

unexpected error even though there is no syntax error in the statement.
i have tried restarting Pycharm.
i tried coping and pasting the code into new tab where every word is pasted in a new line somehow.
can anyone help me find the issue?
this is the image of the error. https://i.stack.imgur.com/Gx8qZ.png
Check to make sure that the name of your variable doesn't contain any spaces. I recommend using snake or camel casing.
total_number_of_times = 1 #snake
totalNumberOfTimes = 1 #camel

I'm not getting any output in the correct code (2nd code)?

Hi and thanks in advance for any help.
Here is the code that works with the proper output.
first_name="ada"
last_name="lovelace"
full_name=f"{first_name} {last_name}"
message=(f"Hello, {full_name.title()}!")
print(message)
Here is the similar code with no output...and I can't figure out why?
first_name="ada"
last_name="lovelace"
full_name=f"{first_name} {last_name}"
print(full_name)
I know it is correct coding based on the teacher's response but can't figure out why?
Thank you for any help!
You forgot to add .title() to your string formatting request.
You can do either:
# to get both capitalized add .title() twice here at "full name".
first_name="ada"
last_name="lovelace"
full_name=f"{first_name.title()} {last_name.title()}"
print(full_name)
or:
# to get both capitalized add .title() once here at "message".
first_name="ada"
last_name="lovelace"
full_name=f"{first_name} {last_name}"
message=(f"{full_name.title()}")
print(message)

Mac: Excel VBA - Do HTTP request to website with XPath and get value

I would like to get the value of a specified XPath of a website in Excel. However, I always get 0 returned in my spreadsheet...
This is my code so far:
Function HTTPGet2() As String
HTTPGet2 = MacScript("do shell script ""xmllint --html -xpath 'string(//*[#id=""AssetAllocationLongShortTable1""]/table/tbody/tr[1]/td[1])' http://tools.morningstar.de/de/xray/default.aspx\?LanguageId\=de-DE\&PortfolioType\=2\&SecurityTokenList\=F000000EM3\]2\]0\]ETEXG$XETR\|F00000J8T2\]2\]0\]FODEU$$ALL\&values\=50.00\|50.00\&CurrencyId\=EUR\&from\=editholding""")
End Function
If I execute this function in the terminal everything works fine!
But in the excel I get returned only a #VALUE! in the selected cell..
Could you guys may help me and explain whats wrong and help me out?
Don't forget, I am using a Mac!
Kind regards and Thank You!

Resources