网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
11月04日漏签0天
excel吧 关注:281,748贴子:1,554,541
  • 看贴

  • 图片

  • 吧主推荐

  • 视频

  • 游戏

  • 4回复贴,共1页
<<返回excel吧
>0< 加载中...

请教EXCEL2013错误91

  • 只看楼主
  • 收藏

  • 回复
  • qinqinyao1314
  • E见钟情
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
*记录错误日志
Public Sub ReportError(ByVal ErrorSource As String, Optional ByVal Memo As String, Optional ByVal ShowMessage As Boolean = False)
Dim strErrDesc As String
Dim strFilename As String
strErrDesc = Err.Description
strFilename = ThisWorkbook.path & "\Log\StartUpMacro.log"
Call mobjHelper.ReportError(strFilename, "StartUpMacro." & ErrorSource, Memo, Err, Erl)
If ShowMessage = True Then
MsgBox strErrDesc, vbCritical, "Error"
Else
End If
On Error Resume Next
End Sub


  • qinqinyao1314
  • E见钟情
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
开始运行的时候会出现

Declaer 改成Declare PtrSafe就会出现上面的错误


2025-11-04 01:27:39
广告
不感兴趣
开通SVIP免广告
  • qinqinyao1314
  • E见钟情
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
**************************************************************
* Author: 刘林丰(liulinfeng)
* ID: 100448
* Date: 2009-07-08
**************************************************************
Option Explicit
Private Declare PtrSafe Function DcGetInstance Lib "DirectCom" Alias "GETINSTANCE" (FName As String, className As String) As Object
Private Declare PtrSafe Function DcGetInstanceLastError Lib "DirectCom" Alias "GETINSTANCELASTERROR" () As String
Private Declare PtrSafe Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Fso As New FileSystemObject
Private mobjHelper As Object
*CSEH: UniErrRaise
Public Property Get Helper() As Object
Dim strLibFile As String
If mobjHelper Is Nothing Then
strLibFile = Fso.BuildPath(ThisWorkbook.path, "QuoterMacro.dll")
Set mobjHelper = CreateObjectEx(strLibFile, "QuoterMacro", "Helper")
Else
End If
Set Helper = mobjHelper
End Property
Public Function CreateObjectEx(ByVal libFullPath As String, ByVal projectName As String, ByVal className As String) As Object
*<EhHeader>
On Error GoTo ErrorHandle
*</EhHeader>
Dim lngPos As Long
Dim strProgID As String
Dim obj As Object
Dim errMsg As String
*调试模式,从注册表中创建组件
100 If IsDebugMode() Then
102 strProgID = projectName & "." & className
104 Set CreateObjectEx = VBA.CreateObject(strProgID)
*非调试,从文件中直接创建组件
Else
106 Set obj = DcGetInstance(libFullPath, className)
108 If obj Is Nothing Then
110 errMsg = DcGetInstanceLastError()
112 Err.Raise vbObjectError, , errMsg
Else
End If
114 Set CreateObjectEx = obj
End If
*<EhFooter>
Exit Function
ErrorHandle:
MsgBox Err.Description & " at Common.CreateObjectEx." & Erl, vbCritical
*</EhFooter>
End Function
*CSEH: UniErrRaise
Public Function AddBackslash(ByVal strPath As String) As String
*<EhHeader>
On Error GoTo ErrorHandle
*</EhHeader>
100 If Right(strPath, 1) = "\" Then
102 AddBackslash = strPath
Else
104 AddBackslash = strPath & "\"
End If
*<EhFooter>
Exit Function
ErrorHandle:
MsgBox Err.Description & " at Common.AddBackslash." & Erl, vbCritical
*</EhFooter>
End Function
*是否调试模式
Public Function IsDebugMode() As Boolean
*<EhHeader>
On Error GoTo ErrorHandle
*</EhHeader>
Dim strIniFile As String
Dim strTemp As String
100 strIniFile = ThisWorkbook.path & "\QuoterMacro.ini"
102 If Len(Dir(strIniFile)) = 0 Then
Exit Function
Else
End If
104 strTemp = Trim(UCase(GetIniSetting(strIniFile, "General", "DebugMode")))
106 If strTemp = "TRUE" Then
108 IsDebugMode = True
Else
End If
*<EhFooter>
Exit Function
ErrorHandle:
MsgBox Err.Description & " at IsDebugMode line " & Erl, vbCritical
*</EhFooter>
End Function
*记录错误日志
Public Sub ReportError(ByVal ErrorSource As String, Optional ByVal Memo As String, Optional ByVal ShowMessage As Boolean = False)
Dim strErrDesc As String
Dim strFilename As String
strErrDesc = Err.Description
strFilename = ThisWorkbook.path & "\Log\StartUpMacro.log"
Call mobjHelper.ReportError(strFilename, "StartUpMacro." & ErrorSource, Memo, Err, Erl)
If ShowMessage = True Then
MsgBox strErrDesc, vbCritical, "Error"
Else
End If
On Error Resume Next
End Sub
*抛出错误
Public Sub RaiseError(ByVal ErrorSource As String, Optional ByVal Memo As String)
Call mobjHelper.RaiseError("StartUpMacro." & ErrorSource, Memo, Err, Erl)
On Error Resume Next
End Sub
***************************************************************************************
** 功能:从INI文件中读取设置
**
** 入口参数:
** FileName: 要读取INI文件名称
** Section: 设置段名称
** Key: 设置键名称
** DefaultValue: 默认值
**
** 出口参数:
**
** 返回值 :读到的设置值
**
** 调用谁:
**
** 被谁调用:
**
** 作者:文逸斌
**
** 建立时间:2004-11-2
**
**最近修改时间:2004-11-2
***************************************************************************************
Public Function GetIniSetting(ByVal FileName As String, _
ByVal Section As String, _
ByVal Key As String, _
Optional ByVal DefaultValue As String = "") As String
Const BUFFER_SIZE = 1024
Dim strBuffer As String * BUFFER_SIZE
Dim lngZeroPos As Long
100 Call GetPrivateProfileString(Section, Key, DefaultValue, strBuffer, BUFFER_SIZE, FileName)
102 lngZeroPos = InStr(1, strBuffer, Chr(0), vbBinaryCompare)
104 If lngZeroPos = 0 Then
106 GetIniSetting = Trim(strBuffer)
Else
108 GetIniSetting = Trim(Left(strBuffer, lngZeroPos - 1))
End If
End Function


  • qinqinyao1314
  • E见钟情
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
求助啊


  • 轻怡飞舞
  • E见钟情
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
同求


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 4回复贴,共1页
<<返回excel吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示