LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default GetSaveFileName

Hello everyone,

I am using the API GetSaveFileName and all seems to be fine except for when
I press escape to cancel the dialog. I recieve a message that code
processing has been interrupted and asked if I would like to debug or
cancel.

Anyone have any ideas what I can do to get around that?

I am using the code from
http://vbnet.mvps.org/index.html?cod...avedlghook.htm

Public Function ShowSave(Title As String, InitialPath As String,
InitialFilename As String) As String

Dim sFilters As String
Dim pos As Long
Dim buff As String
Dim sLongname As String
Dim sShortname As String

'if first time through set the appropriate OFN size
If OSV_VERSION_LENGTH = 0 Then Call SetOSVersion

'filters for the dialog
sFilters = "Excel Files" & vbNullChar & "*.XLS" & vbNullChar & vbNullChar

DialogCaption = Title

With OFN

.nStructSize = OSV_VERSION_LENGTH
.hwndOwner = 0
.sFilter = sFilters
.nFilterIndex = 2
.sFile = InitialFilename & Space$(1024) & vbNullChar & vbNullChar
.nMaxFile = Len(.sFile)
.sDefFileExt = "xls" & vbNullChar & vbNullChar
.sFileTitle = vbNullChar & Space$(512) & vbNullChar & vbNullChar
.nMaxTitle = Len(OFN.sFileTitle)
.sInitialDir = InitialPath & vbNullChar & vbNullChar
.sDialogTitle = "Blah Blah Blah"
.flags = OFS_FILE_SAVE_FLAGS Or _
OFN_ENABLESIZING Or _
OFN_ENABLEHOOK
.fnHook = FARPROC(AddressOf OFNHookProc)

End With

'call the API
If GetSaveFileName(OFN) Then
buff = Trim$(Left$(OFN.sFile, Len(OFN.sFile) - 2))
ShowSave = Trim(buff)
End If

End Function

Excel 2000-2003


TIA


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
GetSaveFileName across mixed language network Nick Cranham Excel Programming 0 February 12th 04 07:12 AM


All times are GMT +1. The time now is 04:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"