只要把单元格的格式设置为文本就行了
Option Explicit
Private Sub Command1_Click()
Dim ExcelBook As Excel.Workbook
Dim Esheets As Sheets
Dim Esheet As Excel.Worksheet
Dim strFilePath As String
strFilePath = "D:/1.xls"
If Dir(strFilePath, vbNormal) = "" Then
Exit Sub
End If
Set ExcelBook = GetObject(strFilePath)
Set Esheets = ExcelBook.Sheets
If Esheets.Count = 0 Then Exit Sub
ExcelBook.Activate
Set Esheet = Esheets(1)
Esheet.Activate
'设置单元格的格式为文本
Esheet.Range("A1").NumberFormatLocal = "@"
Esheet.Cells(1, 1) = "00001"
ExcelBook.Save
ExcelBook.Close
Set ExcelBook = Nothing
Set Esheets = Nothing
Set Esheet = Nothing
End Sub
Option Explicit
Private Sub Command1_Click()
Dim ExcelBook As Excel.Workbook
Dim Esheets As Sheets
Dim Esheet As Excel.Worksheet
Dim strFilePath As String
strFilePath = "D:/1.xls"
If Dir(strFilePath, vbNormal) = "" Then
Exit Sub
End If
Set ExcelBook = GetObject(strFilePath)
Set Esheets = ExcelBook.Sheets
If Esheets.Count = 0 Then Exit Sub
ExcelBook.Activate
Set Esheet = Esheets(1)
Esheet.Activate
'设置单元格的格式为文本
Esheet.Range("A1").NumberFormatLocal = "@"
Esheet.Cells(1, 1) = "00001"
ExcelBook.Save
ExcelBook.Close
Set ExcelBook = Nothing
Set Esheets = Nothing
Set Esheet = Nothing
End Sub