From: Aref Mikati on 3 Nov 2006 19:55 In the following code, the Filters.Add method is, from time to time, raising err 438. Any suggestions? Set fd = Application.FileDialog(msoFileDialogOpen) With fd .AllowMultiSelect = False .ButtonName = "Open" .Title = gstrDefaultTitle & " - Project: " & Mid(strInitialFileName, 4, 3) .Filters.Clear .Filters.Add "All Files", "*.*", 1 .Filters.Add "Images", "*.gif; *.jpg; *.jpeg; *.tif; *.pdf", 2 .FilterIndex = 2 .InitialView = msoFileDialogViewDetails .InitialFileName = strInitialFileName If .Show = -1 Then Application.FollowHyperlink .SelectedItems(1) End If End With Set fd = Nothing ' Dim dummy As Boolean
From: Allen Browne on 3 Nov 2006 22:14 The FileDialog is not really usable in Access. You don't indicate which line causes the error, but using save rather than open will give the error. There could be other points where it would fail as well. Use the API call instead: http://www.mvps.org/access/api/api0001.htm -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Aref Mikati" <ArefMikati(a)discussions.microsoft.com> wrote in message news:F5441F2A-E2C6-46D5-8351-9D7CACB6D48C(a)microsoft.com... > In the following code, the Filters.Add method is, from time to time, > raising > err 438. > Any suggestions? > Set fd = Application.FileDialog(msoFileDialogOpen) > With fd > .AllowMultiSelect = False > .ButtonName = "Open" > .Title = gstrDefaultTitle & " - Project: " & > Mid(strInitialFileName, > 4, 3) > .Filters.Clear > .Filters.Add "All Files", "*.*", 1 > .Filters.Add "Images", "*.gif; *.jpg; *.jpeg; *.tif; *.pdf", 2 > .FilterIndex = 2 > .InitialView = msoFileDialogViewDetails > .InitialFileName = strInitialFileName > If .Show = -1 Then > Application.FollowHyperlink .SelectedItems(1) > End If > End With > Set fd = Nothing ' Dim dummy As Boolean >
|
Pages: 1 Prev: Exporting records Next: Executing MS Excel through MS Access vba |