2017-02-13 153 views
0

是否有可能將xlsx表格與宏轉換爲exe文件而不打開excel?我嘗試了一些轉換器,但都打開excel。Excel文件exe(xls到exe)

+0

你想通過將xls文件轉換爲exe來實現什麼目的,並且仍然不想打開excel? @Fiinek? –

+0

我想阻止菜單和所有功能進行編輯。 –

回答

1

將代碼粘貼到記事本中並保存爲VBS文件。還要更改文件路徑和宏名稱。它從用戶確認開始。

Option Explicit 

Dim xlApp, xlBook 
dim x 


x=msgbox("Do You want to run the macro",4+64+0+4096,"Confirmation...") 

if x= vbyes then 

Set xlApp = CreateObject("Excel.Application") 

'~~> Change Path here to your excel file 
Set xlBook = xlApp.Workbooks.Open("C:\Users\Deb\Desktop\contactlist2.xlsm", 0, True) 

'~~> Change macro name 

xlApp.Run "check_data" 

xlbook.save 

xlBook.Close 

xlApp.Quit 

Set xlBook = Nothing 

Set xlApp = Nothing 

WScript.Echo "Finished." 

WScript.Quit 

end if 
0

對於這一點,你可以嘗試運行宏從外部練成像如下 -

Set objExcel = CreateObject("Excel.Application") 
objExcel.Application.Run "'full path to excel file'!module name.macro name" 
objExcel.DisplayAlerts = False 
objExcel.Application.Quit 
Set objExcel = Nothing 

enter link description here

要打開只讀工作簿,試試你的objExcel前右側添加以下行.Application.Run線

套裝書= objExcel.Workbooks.Open( '全到excel文件路徑' ,, TRUE)

+0

和全張? –

+0

請檢查鏈接。在那裏給出瞭如何以只讀模式打開工作簿。 –

+0

如果這個答案對您有用,請將其標記爲答案。 –