Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2007

Tip: Looking for answers? Try searching our database.

FileDialog deactivating the close button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fredriksson - 25 Jan 2007 20:45 GMT
When the user is selecting a file to open, I want to deactivate the X (Close
Button)  so the user can not exit out of the macro.

Do you know if this can be done?

With Application.FileDialog(msoFileDialogFilePicker)
       .AllowMultiSelect = False
       .Filters.Add "Text files", "*.den"
       If .Show = True Then
           Txt = .SelectedItems(1)
           'Import data
            For x = LBound(ColumnsDesired) To UBound(ColumnsDesired)
                ColumnArray(x, 1) = ColumnsDesired(x)
                ColumnArray(x, 2) = DataTypeArray(x)
            Next x
           
            Workbooks.OpenText Filename:=Txt, _
            DataType:=xlFixedWidth, FieldInfo:=ColumnArray
            ActiveSheet.UsedRange.Copy Destination:=Isheet.Range("A1")
            ActiveWorkbook.Close SaveChanges:=False
       End If
   End With
Susan - 25 Jan 2007 20:53 GMT
Private Sub UserForm_QueryClose(Cancel As Integer, _
 CloseMode As Integer)
 If CloseMode = vbFormControlMenu Then
   Cancel = True
   MsgBox "Please use the button to close the form", vbInformation

 End If
End Sub
xxxxxxxxxxxxxxxxx
susan

> When the user is selecting a file to open, I want to deactivate the X (Close
> Button)  so the user can not exit out of the macro.
[quoted text clipped - 21 lines]
> --
> Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/excel-programming/200701/1
Susan - 25 Jan 2007 20:53 GMT
whoops - i misread your post - that will disable the X on a userform -
don't know if it will work for the worksheet itself.....
sorry
susan

> When the user is selecting a file to open, I want to deactivate the X (Close
> Button)  so the user can not exit out of the macro.
[quoted text clipped - 21 lines]
> --
> Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/excel-programming/200701/1
Jim Cone - 25 Jan 2007 23:09 GMT
Directly above "End If" add...

  Else
    'Code to keep the macro going
Signature

Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

"Fredriksson via OfficeKB.com"
<u27002@uwe>
wrote in message
When the user is selecting a file to open, I want to deactivate the X (Close
Button)  so the user can not exit out of the macro.

Do you know if this can be done?

With Application.FileDialog(msoFileDialogFilePicker)
       .AllowMultiSelect = False
       .Filters.Add "Text files", "*.den"
       If .Show = True Then
           Txt = .SelectedItems(1)
           'Import data
            For x = LBound(ColumnsDesired) To UBound(ColumnsDesired)
                ColumnArray(x, 1) = ColumnsDesired(x)
                ColumnArray(x, 2) = DataTypeArray(x)
            Next x
           
            Workbooks.OpenText Filename:=Txt, _
            DataType:=xlFixedWidth, FieldInfo:=ColumnArray
            ActiveSheet.UsedRange.Copy Destination:=Isheet.Range("A1")
            ActiveWorkbook.Close SaveChanges:=False
       End If
   End With

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.