AnsweredAssumed Answered

Issue Converting VBA Print Macro to VB.Net (No error but won't print)

Question asked by Jonathan Sterling on Aug 23, 2017
Latest reply on Sep 14, 2017 by Jonathan Sterling

Hi gurus,


I have been creating internal macros for our company in VBA for a few years. I have recently begun exploring VB.Net and thought a good trial would be to convert one of the existing VBA macros to a VB.Net standalone format.


I created the form and added/modified all the code for the buttons to work with VB.Net. I did not get any errors, only an issue at line 257 saying the function would not return a value on all code paths (might be the problem but I don't see how). So running the macro brings up the form and the form controls all work. But when I use the "Print Currently Active Drawing" button, it will walk through the entire macro without any issues, but when it gets to the print command it acts like it did not see the command. Won't print, won't even act like it sent anything to the printer.


I know the code functions since it works in VBA, so I am hoping it is an issue of being unfamiliar with VB.Net and I overlooked turning something on or setting up a reference that was needed. I am hoping some of you can take a look at it and give me some feedback on how to get it to print (or just some VB.Net feedback on better ways to do things).


Finally, to get the default print folder to function, there is a text file I included in the zip file called "Printer Default Location.txt" that needs to go in a folder on C ("C:\SolidWorks Files"). It's for saving text for the Form (going to try to learn how to save settings once I can get it to print).


I appreciate you taking time to look at this for me.