标题:请懂行的帮忙看一下在64位Excel里的VB错误问题
只看楼主
szylnl
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-6-2
 问题点数:0 回复次数:0 
请懂行的帮忙看一下在64位Excel里的VB错误问题
懂行的帮忙看一下以下代码在32位Excel下运行没问题,在64位Excel下运行弹出对话框显示错误说是第一行的function需要用ptrsafe标记,请问该如何改,请指教。
Private Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal DirPath As String) As Long[/color]
Function AddPath(Path As String) '批量创建文件夹
    MakeSureDirectoryPathExists (Path)
End Function
Function QueryFile(File, Ftype) '遍历文件夹下的指定格式文件 函数(路径,文件类型)数组
    Dim MyName, Dic, Did, i, MyFileName
    Set Dic = CreateObject("Scripting.Dictionary")    '创建一个字典对象
    Set Did = CreateObject("Scripting.Dictionary")
    Dic.Add (File), ""
    i = 0
    Do While i < Dic.Count
        Ke = Dic.keys   '开始遍历字典
        MyName = Dir(Ke(i), vbDirectory)    '查找目录
        Do While MyName <> ""
            If MyName <> "." And MyName <> ".." Then
                If (GetAttr(Ke(i) & MyName) And vbDirectory) = vbDirectory Then    '如果是次级目录
                    Dic.Add (Ke(i) & MyName & "\"), ""  '就往字典中添加这个次级目录名作为一个条目
                End If
            End If
            MyName = Dir    '继续遍历寻找
        Loop
        i = i + 1
    Loop
    For Each Ke In Dic.keys  '文件清单
        MyFileName = Dir(Ke & "*." & Ftype)
        Do While MyFileName <> ""
            Did.Add (Ke & MyFileName), ""
            MyFileName = Dir
        Loop
    Next
    QueryFile = WorksheetFunction.Transpose(Did.keys)
End Function
Function SaveAs(Path As String) '另存为
    ActiveWorkbook.SaveAs Filename:=Path, FileFormat:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False
End Function
搜索更多相关主题的帖子: 文件夹 Excel 对话框 function 
2013-06-02 09:20



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-414343-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.152934 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved