看板 Python 關於我們 聯絡資訊
今天早上寫了個excel格式整理的code,用到的代碼如下。 def merge_2_cell(sheet,row,col): sheet.range((row,col),(row,col+1)).api.merge() 原本都能用這個function來合併儲存格,但在剛剛電腦突然更新了office系列app之後,現在程式跑起來會跳error如下: AttributeError: ‘<win32com.gen.py.Microsoft Excel 16.0 Object Library.Range instance at 0x1928453528400>’ object has no attribute ‘merge’ 上網查了一下,好像很多人在最近用api的時候都有問題。但目前我找不到解方。 -- Sent from nPTT on my iPhone 13 Pro Max -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.136.219.12 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1679389194.A.205.html
oscarku: 已解決,更新後要用api.Merge() 03/21 17:14