Creating a new EXCEL file Follow
I wanted to ask someone for help.
I want to create a script that will ask me via the input form when printing if I want to create a new document (.xls file) with the name specified by the user.
I give it a name and it saves it in the same folder where the .BTW file is located
Additionally, it will replace the name in my script, so that I can save the data during printing.
'Place script below at to
If Format.IsPrinting = False then Exit sub
Set objCon = CreateObject("ADODB.Connection")
'Create connection (in the case of xls file in the same folder as btw file)
objCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='XXXX.xls';Extended Properties=""Excel 8.0;HDR=YES;"""
strSQL = "INSERT INTO [Arkusz1$] (IL,RL,ZK) values ('" & A1 & A2 & A3 &"','" & B1 & B2 & B3 &"','" & zk &"')"
Set objCon = Nothing
Thank you for your help.
Please sign in to leave a comment.