设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1679|回复: 1
打印 上一主题 下一主题

[API] 需要加什么才能调用GetSaveAsFilename

[复制链接]
跳转到指定楼层
1#
发表于 2008-5-7 12:20:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
需要加什么才能调用GetSaveAsFilenameaccess 中 需要加什么才能调用GetSaveAsFilename ?求高人指点

以下是网上搜的调用 GetOpenFileName 的代码

Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Boolean
Type OPENFILENAME
     lStructSize As Long
     hwndOwner As Long
     hInstance As Long
     lpstrFilter As String
     lpstrCustomFilter As String
     nMaxCustFilter As Long
     nFilterIndex As Long
     lpstrFile As String
     nMaxFile As Long
     lpstrFileTitle As String
     nMaxFileTitle As Long
     lpstrInitialDir As String
     lpstrTitle As String
     flags As Long
     nFileOffset As Integer
     nFileExtension As Integer
     lpstrDefExt As String
     lCustData As Long
     lpfnHook As Long
     lpTemplateName As String
End Type


Private Sub Filename_Click()
On Error GoTo Err_Command5_Click
   
    Dim ofn As OPENFILENAME
   Dim rtn As String
   ofn.lStructSize = Len(ofn)
   ofn.hwndOwner = Me.hwnd
   ofn.lpstrFilter = "Êý¾Ý¿âÎļþ (*.mdb)" & vbNullChar & "*.mdb"
   ofn.lpstrFile = Space(254)
   ofn.nMaxFile = 255
   ofn.lpstrFileTitle = Space(254)
   ofn.nMaxFileTitle = 255
   ofn.lpstrInitialDir = CurrentProject.Path
   ofn.lpstrTitle = "×¼±¸ÉÏ´«µÄÊý¾ÝÎļþΪ"
   ofn.flags = 6148
   rtn = GetOpenFileName(ofn)

   If rtn = True Then
     
      FileName.Text = ofn.lpstrFile
     
      OK.Enabled = True
   Else
       FileName.Text = ""
   End If
   
   
Exit_Command5_Click:
    Exit Sub
Err_Command5_Click:
    MsgBox Err.Description
   
    FileName.SetFocus
    FileName.SelStart = 0
    FileName.SelLength = 100
   
    Resume Exit_Command5_Click
End Sub
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅

点击这里给我发消息

2#
发表于 2008-5-7 12:25:49 | 只看该作者
API那段定义需要放在模块中,且要定义为公共
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-11-29 21:33 , Processed in 0.085622 second(s), 25 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表