vbaautocompleteuppercasecase-sensitivelowercase

How to disable autocomplete in vba?


I'm creating the program for exporting several excel sheets to pdf with watermarks and form fields etc. Everything works smooth right now but the final pdf is quite large. So I was thinking about the best way to make it smaller and I found out that the best result is by simply opening the pdf in Adobe Acrobat and then print it with "Adobe PDF" printer. This way I reduce the file size to 1/6 of the original size.

So I'm trying to do this via the VBA code and it looks like it's prety straight forward code using the JS.

sPath = "some path"
sPathFinal = "some other path"

Dim AcroApp As AcroAVDoc: Set AcroApp = CreateObject("AcroExch.AVDoc")
Dim Document As AcroPDDoc
Dim JSO, pp

AcroApp.Open sPath, ""

Set Document = AcroApp.GetPDDoc()
Set JSO = Document.GetJSObject
Set pp = JSO.getPrintParams

pp.printerName = "Adobe PDF"
pp.Filename = sPathFinal

JSO.Print (pp)

The problem is in the very last line as it should be

JSO.print(pp) - "print" with lowercase "p"

But everytime I step away from the lane, it gets autocorrected to uppercase "P". I tried to turn everything off in Tools -> Options -> Editor -> Code settings as well as on other places in options tab but had no luck so far.

Is there a way to prevent this autocorrect?

(Also I'm not native english speaking so there is quite big chance that it is called differently :)


Solution

  • Short answer is no you can't, because VBA editor auto-correct the case in your code.

    This is because VB is case-sensitive (despite it doesn't look like it is), and the editor tries to prevent typo by changing the case of your variables.

    If you want to preserve the case and avoid auto-correct, the simplest solution is to use another editor (like Notepad) and compile your code from the command-line.

    Hope this help.