MS Access HOMEPATH 保存的导出

发布于 2024-11-07 14:50:26 字数 241 浏览 0 评论 0原文

我目前正在使用 Microsoft access 2007,并且在程序上创建了几个已保存的导出,然后将它们设置为按钮以供使用。该数据库必须在几台不同的计算机上使用,并且由于我的用户名在其他计算机上不足以作为保存导出的目录的一部分,因此我一直在尝试在 Windows 中使用 %homepath% 变量来替换托管数据任务窗口中的路径,但没有运气,有人遇到过这个问题,或者有另一种方法来处理这个问题,文件必须导出到 xp 之外的任何 Windows 系统上的我的文档文件夹

I'm currently using Microsoft access 2007 and I have created several saved exports, on the program, i then set them up to buttons for use. this database has to be used on several different computers, and since my username won't suffice on the other machines as part of the directory that will hold the exports, I have been trying to use the %homepath% variable in windows, to replace the path in the Managed Data Tasks window but with no luck, has any one ran into this problem, or have another way to handle this, the files HAVE to be exported to the my documents folder on any windows system beyone xp

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

遮云壑 2024-11-14 14:50:26

您可以将它们导出到共享云端硬盘吗?

Can you export them to a shared drive?

胡大本事 2024-11-14 14:50:26

将以下代码复制并粘贴到标准代码模块中。调用方式如下:

Debug.Print SpecFolder(CSIDL_PERSONAL)

'----- Special Folder declarations -------------------------------------------'
'"Identify the Location of Special Folders with API Calls" article in MSDN    '
'See http://msdn.microsoft.com/en-us/library/aa140088(office.10).aspx for more info'
''
'Declaration section for APIs needed to get the path to My Documents:'
Private Declare Function SHGetSpecialFolderLocation _
                          Lib "Shell32" _
                              (ByVal hWnd As Long, ByVal nFolder As Long, ppidl As Long) As Long

Private Declare Function SHGetPathFromIDList _
                          Lib "Shell32" Alias "SHGetPathFromIDListA" _
                              (ByVal Pidl As Long, ByVal pszPath As String) As Long

Private Declare Sub CoTaskMemFree Lib "ole32" (ByVal pvoid As Long)

Private Const MAX_PATH = 260
Private Const NOERROR = 0

Public Enum CSIDL
    CSIDL_PERSONAL = &H5             'Current user My Documents'
    CSIDL_DESKTOPDIRECTORY = &H10    'Current user Desktop'
    CSIDL_MYPICTURES = 39            'Current user My Pictures'
End Enum
'================================================================='

Function SpecFolder(ByVal Folder As CSIDL) As String
Dim PidlFound As Long, FolderFound As Long
Dim Pidl As Long, strPath As String

    'Create buffer to hold path'
    strPath = Space(MAX_PATH)
    'Find Pointer to item ID List (PIDL)'
    PidlFound = SHGetSpecialFolderLocation(0, Folder, Pidl)
    If PidlFound = NOERROR Then
        'Look up path to special folder using the PIDL we found above'
        FolderFound = SHGetPathFromIDList(Pidl, strPath)
        If FolderFound Then
            'Return only the portion of the string buffer we want'
            '  (everything up to the null terminating character)'
            SpecFolder = Left$(strPath, _
                               InStr(1, strPath, vbNullChar) - 1)
        End If
    End If
    'When an API function creates a PIDL, memory is automatically allocated to storing it'
    '   CoTaskMemFree frees that allocated memory'
    CoTaskMemFree Pidl
End Function

Copy and paste the following code into a standard code module. Call as follows:

Debug.Print SpecFolder(CSIDL_PERSONAL)

'----- Special Folder declarations -------------------------------------------'
'"Identify the Location of Special Folders with API Calls" article in MSDN    '
'See http://msdn.microsoft.com/en-us/library/aa140088(office.10).aspx for more info'
''
'Declaration section for APIs needed to get the path to My Documents:'
Private Declare Function SHGetSpecialFolderLocation _
                          Lib "Shell32" _
                              (ByVal hWnd As Long, ByVal nFolder As Long, ppidl As Long) As Long

Private Declare Function SHGetPathFromIDList _
                          Lib "Shell32" Alias "SHGetPathFromIDListA" _
                              (ByVal Pidl As Long, ByVal pszPath As String) As Long

Private Declare Sub CoTaskMemFree Lib "ole32" (ByVal pvoid As Long)

Private Const MAX_PATH = 260
Private Const NOERROR = 0

Public Enum CSIDL
    CSIDL_PERSONAL = &H5             'Current user My Documents'
    CSIDL_DESKTOPDIRECTORY = &H10    'Current user Desktop'
    CSIDL_MYPICTURES = 39            'Current user My Pictures'
End Enum
'================================================================='

Function SpecFolder(ByVal Folder As CSIDL) As String
Dim PidlFound As Long, FolderFound As Long
Dim Pidl As Long, strPath As String

    'Create buffer to hold path'
    strPath = Space(MAX_PATH)
    'Find Pointer to item ID List (PIDL)'
    PidlFound = SHGetSpecialFolderLocation(0, Folder, Pidl)
    If PidlFound = NOERROR Then
        'Look up path to special folder using the PIDL we found above'
        FolderFound = SHGetPathFromIDList(Pidl, strPath)
        If FolderFound Then
            'Return only the portion of the string buffer we want'
            '  (everything up to the null terminating character)'
            SpecFolder = Left$(strPath, _
                               InStr(1, strPath, vbNullChar) - 1)
        End If
    End If
    'When an API function creates a PIDL, memory is automatically allocated to storing it'
    '   CoTaskMemFree frees that allocated memory'
    CoTaskMemFree Pidl
End Function
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文