[問題] .api.merge()無法使用

看板Python作者 (oscarku)時間2年前 (2023/03/21 16:59), 編輯推噓0(001)
留言1則, 1人參與, 2年前最新討論串1/1
今天早上寫了個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

03/21 17:14, 2年前 , 1F
已解決,更新後要用api.Merge()
03/21 17:14, 1F
文章代碼(AID): #1a6N8A85 (Python)
文章代碼(AID): #1a6N8A85 (Python)