Creating and saving Excel document From VBA in Word -


i want able run macro in word document create excel document , save spreadsheet in shared folder.

this code have far:

public sub monthly_commission_extract()  dim objexcel dim objdoc dim objselection dim saveas1 string saveas1 = ("\\stnlinasshd01\p403759\month end\monthly commission extract\1st save")  set objexcel = createobject("excel.application") set objdoc = objexcel.workbooks.add  objexcel.visible = true  set objselection = objexcel.selection  activeworkbook.saveas filename:=saveas1, fileformat:=-4158, createbackup:=false application.displayalerts = true  end sub 

the code giving me error:

run-time error '424': object required

at following piece of code:

activeworkbook.saveas filename:=saveas1, fileformat:=xltext, createbackup:=false 

please advise how around this.

objexcel.activeworkbook.saveas  

not

activeworkbook.saveas  

anything "belongs" excel must prefixed objexcel application reference.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -