Convert excel to pdf with VBScript -


i want convert pdf excel vbscript gives me error following code:

option explicit dim objexcel, strexcelpath, objsheet  strexcelpath = "path\file.xlsx"  ' open specified spreadsheet , select first worksheet. set objexcel = createobject("excel.application") objexcel.workbooks.open strexcelpath set objsheet = objexcel.activeworkbook.worksheets(1)  ' modify cell. objsheet.range("b8").formular1c1  = [sample1] objsheet.range("g11").formular1c1 = [sample2] objsheet.range("g12").formular1c1 = [sample3] objsheet.range("b10").formular1c1 = [sample4] objsheet.range("b11").formular1c1 = [sample5]  ' save excel. objexcel.activeworkbook.saveas "path\name.xlsx"  ' problem in saving pdf objexcel.activesheet.exportasfixedformat type:=xltypepdf, _         filename:= "path\name.pdf", _         quality:= xlqualitystandard, includedocproperties:=true,_         ignoreprintareas:=false, openafterpublish:=false  objexcel.activeworkbook.close objexcel.application.quit 

if find imporovement in code also, please tell me.

you better try close excel workbook after editing , saving it. updating excel file, in same time trying save pdf. may cause problem.

after saving excel, close , reopen exporting pdf file.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -