跳到主要內容

在 Excel 中產生二維碼(完整方法的簡單指南)

新增一名作者 最後修改時間:2024-05-13

在當今的數位時代,二維碼已成為快速有效地共享資訊的重要工具。本指南探討了直接在 Excel 中建立 QR 碼的不同技術,無論您使用的是最新的 Excel 365 還是早期版本。讀完本文後,您將具備將 QR 碼無縫整合到 Excel 專案中的能力。


在 Excel 365 中產生二維碼

Excel 365 透過以下功能增強了其功能 圖片LAMBDA,允許使用者動態產生二維碼。本節將向您展示如何使用 Excel 365 中的 IMAGE 或 LAMBDA 函數產生 QR 碼。


使用影像函數

在此範例中,我們將使用 IMAGE 函數產生包含以下網站連結的二維碼。

  1. 選擇您想要顯示二維碼的儲存格。這裡我選擇 D3 顯示包含連結的二維碼 Extendoffice 網站。
  2. 輸入以下公式並按 Enter 取得二維碼。
    =IMAGE("https://quickchart.io/qr?text=" & ENCODEURL(C3))
  3. 選擇此公式儲存格,雙擊儲存格的右下角(綠色方塊)以取得其餘的二維碼。
備註:
  • 請將公式中的 C3 以及包含要在 QR 碼中編碼的文字的儲存格引用。
  • 如果引用儲存格中的內容發生變化,二維碼將自動更新。
  • 此公式也可用於在 Google Sheets 中產生 QR 碼。
  • QuickChart.io 提供了一個簡單的API來產生QR碼。產生二維碼的基本URL是 https://quickchart.io/qr?text=.

使用 LAMBDA 函數

對於許多 Excel 使用者來說,記住複雜的公式可能具有挑戰性。在本節中,我將示範如何使用 拉姆達函數 基於前面提到的創建自訂且可重複使用的函數 影像公式。這將使您將來可以使用更簡單的使用者定義函數在 Excel 中產生 QR 碼。

步驟1:使用LAMBDA函數定義名稱
  1. 轉到 公式 選項卡並單擊 定義名稱 ,在 定義名稱 組。
  2. 在彈出 編輯名稱 對話框,您需要配置如下。
    1. 姓名 框中,為 LAMBDA 公式命名。這裡我將其命名為 fn取得二維碼.
    2. 框中,輸入以下公式。
      =LAMBDA(text, IMAGE("https://quickchart.io/qr?text=" & ENCODEURL(text) & "&size=150"))
    3. 點擊 OK 保存定義的名稱。看截圖:
      筆記:
      • 在公式, 150 是 QR 碼影像的預設像素大小。您可以根據需要調整該值,但請記住,產生的二維碼在 Excel 中的實際顯示大小將由儲存格的大小決定。
      • 要了解有關 LAMBDA 函數的更多信息,請訪問此頁面: Excel LAMBDA 函數 (365).
步驟2:應用自訂函數產生二維碼
  1. 選擇您想要顯示二維碼的儲存格。這裡我選擇 D3 顯示包含連結的二維碼 Extendoffice 網站。
  2. 輸入以下公式並按 Enter 取得二維碼。
    =fnGetQRCode(C3)
  3. 選擇此公式儲存格,雙擊儲存格的右下角(綠色方塊)以取得其餘的二維碼。
    筆記:
    • 在公式:
      • fn取得二維碼 是您在步驟 1 中定義的名稱。
      • 請更換 C3 以及包含要在 QR 碼中編碼的文字的儲存格引用。
    • 如果引用儲存格中的內容發生變化,二維碼將自動更新。

在所有 Excel 版本中產生 QR 碼

對於無法存取 Excel 365 的用戶,仍然有可靠的選項可以透過加載項和外部工具產生 QR 碼,從而可以在所有版本的 Excel 中存取此功能。


使用Excel內建外掛程式一一產生二維碼

Excel 加載項如 QR4辦公室 提供跨多個版本的 Excel 相容的強大替代方案。此方法允許對 QR 碼進行詳細定制,非常適合需要在文件中偶爾產生程式碼的使用者。

步驟 1:安裝 QR4Office 插件
  1. 造訪 插入 > 獲取加載項.
    備註:如果看不到 獲取加載項 命令下的 插入 功能區中的選項卡,您需要手動新增它。以下是將此命令添加到 快速訪問工具欄:
    1. 點擊 自定義快速訪問工具欄 下拉箭頭並選擇 更多命令 從菜單。
    2. Word選項“ 窗口:
      1. 選擇 功能區中沒有的命令 來自 從中選擇命令 下拉列表。
      2. 查找並選擇 獲取加載項 在左側命令清單中。
      3. 點擊 加入 按鈕( 獲取加載項 命令將會新增到右窗格)。
      4. 點擊 OK 保存更改。 看截圖:
    3. 獲取加載項 命令現已添加到 快速訪問工具欄。您可以點擊它來打開 Office 加載項 儲存。
  2. Office 加載項 商店:
    1. 鍵入“QR4辦公室“ 在搜尋框中並按 Enter.
    2. 一旦 QR4辦公室 出現加載項,點選 加入 按鈕進行安裝。
  3. 在下面的提示框中,按一下 繼續.
步驟2:使用QR4Office外掛程式產生二維碼

安裝後, QR 圖碼 窗格將自動在您的工作簿右側打開,讓您可以產生二維碼,如下所示。

  1. 選擇包含要在 QR 碼中編碼的文字或連結的儲存格。
    在這種情況下,請附上指向 Extendoffice 網站,我選擇單元格 C3 包含網址。
  2. 點擊 複製目前文件選擇 按鈕將儲存格內容傳輸到 QR4Office 欄位。
    尖端:或者,您可以從下拉清單中選擇 URL 或文字類型,然後在文字方塊中手動輸入所需資訊。
  3. 選項 部分,您可以選擇透過選擇顏色、背景和大小來自訂 QR 碼的外觀,或保留預設設定。
  4. 選擇 QR 碼的目標儲存格。這裡我選擇 D3.
  5. 點擊 插入 將 QR 碼放入所選單元格中。看截圖:
  6. 重複以上5步驟即可產生其他二維碼。

使用Kutools for Excel批次產生QR碼

還有一個插件, Excel的Kutools 與 QR4Office 相比,它具有在選定範圍內批量生成 QR 碼的能力,具有明顯的優勢。這 插入二維碼 的特點 Excel的Kutools 對於需要高效創建多個二維碼的用戶來說尤其有價值。它可以跨多個單元實現流程自動化,從而節省時間並最大限度地減少手動輸入錯誤。

安裝 Kutools for Excel, 去選擇 庫工具 > 插入 > 插入二維碼 打開 插入災難復原程式碼 ,然後就可以批次產生二維碼了,如下:

  1. 數據范圍 在欄位中,選取包含要在 QR 碼中編碼的文字或連結的儲存格範圍。
  2. 插入範圍 在欄位中,選擇一個儲存格範圍來放置對應的二維碼。
  3. 選項 部分,您可以選擇透過指定大小、線條顏色等來自訂 QR 碼的外觀,或保留預設設定。
  4. 點擊 產生 按鈕同時為所有選取的儲存格產生二維碼。
備註:使用此功能之前,請確保已安裝 Kutools for Excel。 立即下載具有 Kutools for Excel 全部功能的 30 天免費試用版!

無論您使用 Excel 365 的進階功能還是依賴適用於所有版本的加載項,在 Excel 中產生 QR 碼都非常簡單。透過遵循本指南中概述的步驟,您可以有效地將 QR 碼整合到 Excel 工作表中,從而增強資料的互動性和可訪問性。探索這些方法,找到最適合您需求的方法,並以新穎的創新方式簡化您的工作流程。對於那些渴望深入研究 Excel 功能的人,我們的網站擁有豐富的教學。 在這裡了解更多 Excel 提示和技巧.

最佳辦公生產力工具

🤖 Kutools 人工智慧助手:基於以下內容徹底改變數據分析: 智慧執行   |  生成代碼  |  建立自訂公式  |  分析數據並產生圖表  |  呼叫 Kutools 函數...
熱門特色: 尋找、突出顯示或識別重複項   |  刪除空白行   |  合併列或儲存格而不遺失數據   |   沒有公式的回合 ...
超級查詢: 多條件VLookup    多值VLookup  |   跨多個工作表的 VLookup   |   模糊查詢 ....
高級下拉列表: 快速建立下拉列表   |  依賴下拉列表   |  多選下拉列表 ....
欄目經理: 新增特定數量的列  |  移動列  |  切換隱藏列的可見性狀態  |  比較範圍和列 ...
特色功能: 網格焦點   |  設計圖   |   大方程式酒吧    工作簿和工作表管理器   |  資源庫 (自動文字)   |  日期選擇器   |  合併工作表   |  加密/解密單元格    按清單發送電子郵件   |  超級濾鏡   |   特殊過濾器 (過濾粗體/斜體/刪除線...)...
前 15 個工具集12 文本 工具 (添加文本, 刪除字符,...)   |   50+ 圖表 類型 (甘特圖,...)   |   40+ 實用 公式 (根據生日計算年齡,...)   |   19 插入 工具 (插入二維碼, 從路徑插入圖片,...)   |   12 轉化 工具 (數字到單詞, 貨幣兌換,...)   |   7 合併與拆分 工具 (高級合併行, 分裂細胞,...)   |   ... 和更多

使用 Kutools for Excel 增強您的 Excel 技能,體驗前所未有的效率。 Kutools for Excel 提供了 300 多種進階功能來提高生產力並節省時間。  點擊此處獲取您最需要的功能...

產品描述


Office選項卡為Office帶來了選項卡式界面,使您的工作更加輕鬆

  • 在Word,Excel,PowerPoint中啟用選項卡式編輯和閱讀,發布者,Access,Visio和Project。
  • 在同一窗口的新選項卡中而不是在新窗口中打開並創建多個文檔。
  • 將您的工作效率提高 50%,每天為您減少數百次鼠標點擊!
Comments (38)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Is it possible to make a payment qr code in excel?
f.e. In cell A1 I've an amout of 10 euro, and in cell B2 I want to have an qr code so anyone can pay me with the qr code?

Thanks.
This comment was minimized by the moderator on the site
Hi Ruben,

Thank you for reaching out with your question. While Kutools for Excel does feature QR code generation, creating a payment QR code directly in Excel for transactional purposes is beyond the scope of this feature. Payment QR codes usually require integration with financial services or payment platforms to ensure secure transactions. I recommend exploring services specifically designed for creating payment QR codes, such as those offered by banks or digital payment systems. These platforms can generate a QR code linked to your payment details securely. Once you have the payment QR code, you could then include it in your Excel document as an image.
This comment was minimized by the moderator on the site
Hello

The download link provided in step 4 appears to be only Microsoft Barcode Control 14.0. Can anyone suggest a correct link for 16.0 please?

Thank you.
This comment was minimized by the moderator on the site
1 Sheets waar in de cellen van de rij random QR codes binnen komen. Waarvan elke QR code automatisch de juiste Sheets openend?
Of de BVA commando codes van de Button om de koppeling maken naar een andere sheets.
Dan ben erg dankbaar voor.
(dit is voor vrijwilligerswerk)

Groetjes,
H. van Schaijk
This comment was minimized by the moderator on the site
Hi H. van Schaijk,
I can't fix this problem. Sorry about that.
This comment was minimized by the moderator on the site
Hi folks,
Below code works fine with me, which is linked to cell range & generates the QR at each row cell 5000 nos, however I would like to stop the QR object generation if the reference cell value is zero / otherway round should generate the QR at adjucent cell if the value at reference cell is more than zero or <>""

Please seek experts assistance!!

thank you in advance

Sub Gen_StockOut_QR()
MsgBox ("Will Generate QR Code for Stock_Out Items at In@Out Sheet")
Sheets("In@Out_Data").Select
ActiveSheet.Unprotect Password:=" "
'Column range set at QR_Code
Range("QR_Code").Select

For Each cell In Selection
'cell.Offset(0, 23).Select ' 1 indicates the position of excel column A1 from the formula/webaddress/site/characters to be used to generate QR code
cell.Offset(0, 0).Select

' My case QRCode is at column 24 hence 24 as column from A1, QR Size 100*100
FilePath = "http://chart.googleapis.com/chart?chs=100x100&&cht=qr&chl=" & WorksheetFunction.EncodeURL(cell.Value) ' here is the cell value

With ActiveSheet.Pictures.Insert(FilePath)
'.ShapeRange.ScaleWidth 0.95, msoFalse, msoScaleFromTopLeft
'.ShapeRange.ScaleHeight 0.95, msoFalse, msoScaleFromTopLeft

End With
Next cell
End Sub
This comment was minimized by the moderator on the site
Interesting article - thank you.  How do I remove the custom control from the list please?
This comment was minimized by the moderator on the site
Hi,Do you mean to remove the Form Control inserted in the VBA code method? If so, you just need to right click it (when there is a context menu listed, click anywhere outside it to hide the context menu), and then press Delete to remove it.
This comment was minimized by the moderator on the site
Olá! Para mim, nenhum dos comentários ou esse post funcionou corretamente, mas utilizando o Visual Basic com o código que deixarei abaixo funcionou, pois criou uma função para mim. E para usar a função é só abrir a planilha e digitar: "=QrCode("célula desejada")"




Function QrCode(codetext As String)
Dim URL As String, MyCell As Range
'Para gerar o código, precisa a máquina ter acesso a internet
Set MyCell = Application.Caller
URL = "https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=" & codetext
On Error Resume Next
ActiveSheet.Pictures("QR_" & MyCell.Address(False, False)).Delete
On Error GoTo 0
ActiveSheet.Pictures.Insert(URL).Select
With Selection.ShapeRange(1)
.PictureFormat.CropLeft = 15
.PictureFormat.CropRight = 15
.PictureFormat.CropTop = 15
.PictureFormat.CropBottom = 15
.Name = "QR_" & MyCell.Address(False, False)
.Left = MyCell.Left + 2
.Top = MyCell.Top + 2
End With
QrCode = ""
End Function
This comment was minimized by the moderator on the site
Wie lösche ich die QR Code Grafik wieder ? wenn ich mit den Skript Wie erstelle ich einen QR-Code basierend auf dem Zellenwert in Excel? einen QR Code erzeugt habe ?
This comment was minimized by the moderator on the site
Hi All,

I modified the VBA code for creation a multi QR codes from selection in excel column

Follow until step 10 then add this code

Sub setQR()

Dim xSRg As Range
Dim xRRg As Range
Dim xObjOLE As OLEObject
On Error Resume Next
Dim srcSelection As Range
Dim srcCell As String
For Each srcSelection In Application.Selection
Dim qrCelltoupdate As String
Dim qrTxt As String
qrCelltoupdate = srcSelection.Offset(0, 1).Address
qrTxt = srcSelection.Text
Worksheets("Sheet1").Range(qrCelltoupdate).Select
Application.ScreenUpdating = False
Set xObjOLE = ActiveSheet.OLEObjects.Add("BARCODE.BarCodeCtrl.1")
xObjOLE.Object.Style = 11
xObjOLE.Object.Value = qrTxt
ActiveSheet.Shapes.Item(xObjOLE.Name).Copy
ActiveSheet.Paste
xObjOLE.Delete
Next srcSelection
'Create Qr code from selection multi cells
End Sub


In step 12
Assign Macro
Chose: Sheet1.setQR

QR codes will be populated in next column

Hope that helps for you all
This comment was minimized by the moderator on the site
Hi ChavdarHarchev.
First of all thank You very much for Your nice work.

Is it possible for You to show how the VBA code looks like when it is finished?
Best regards
Pierre Galuszka.
This comment was minimized by the moderator on the site
Hi All,
I modified the VBA code for creation a multi QR codes from selection in excel column
Follow until step 10 then add this code
Sub setQR()

Dim xSRg As Range
Dim xRRg As Range
Dim xObjOLE As OLEObject
On Error Resume Next
Dim srcSelection As Range
Dim srcCell As String
For Each srcSelection In Application.Selection
Dim qrCelltoupdate As String
Dim qrTxt As String
qrCelltoupdate = srcSelection.Offset(0, 1).Address
qrTxt = srcSelection.Text
Worksheets("Sheet1").Range(qrCelltoupdate).Select
Application.ScreenUpdating = False
Set xObjOLE = ActiveSheet.OLEObjects.Add("BARCODE.BarCodeCtrl.1")
xObjOLE.Object.Style = 11
xObjOLE.Object.Value = qrTxt
ActiveSheet.Shapes.Item(xObjOLE.Name).Copy
ActiveSheet.Paste
xObjOLE.Delete
Next srcSelection
'Create Qr code from selection multi cells
End Sub


In step 12 Assign Macro Chose: Sheet1.setQR
QR codes will be populated in next column
Hope that helps for you all
This comment was minimized by the moderator on the site
I didn't have "Microsoft Barcode Control 16.0" so I down loaded per instruction. And open Excel with Admin mode. Then try to "Register Custom" . But I opened Barcode control folder and select MSBCODE964,OCX. Then there is error message came out. It said "The selected file does not contain self-registrating ActiveX control". What it means? What is the problem. And how can I install that?
This comment was minimized by the moderator on the site
1)Click File > Options.

2)Click Trust Center > Trust Center Settings > ActiveX Settings.

Click the options below, and then click OK.
* Enable all controls without restrictions and without prompting (not recommended)
3)Click Ok
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations