Results 1 to 25 of 25

Thread: Excel.. Exit Edit Mode [RESOLVED.. finally :-P]

Hybrid View

  1. #1
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Excel.. Exit Edit Mode

    What if, before you make the copy/paste, you change the selection to
    another row and then back to the sorce/target row? That should take it out
    of edit mode.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  2. #2

    Thread Starter
    Addicted Member SpeedyDog's Avatar
    Join Date
    Feb 2004
    Location
    Missouri, USA
    Posts
    189

    Re: Excel.. Exit Edit Mode

    xlSheetInput.Cells(1, 1).Select

    ERROR:
    Select Method or Range Class Failed.


    ahhhh!!!!... why doesn't that work?!

    -SpeedyDog

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Excel.. Exit Edit Mode

    Ok, here is the perfect solution. Disable editing on just your application object.
    It will not effect any other instances before or after, that the user may or
    may not have opened already or will open.

    VB Code:
    1. Option Explicit
    2.  
    3. Private moApp As Excel.Application
    4. Private moWB As Excel.Workbook
    5.    
    6. Private Sub Command1_Click()
    7.     moWB.Sheets("Sheet1").Cells(1, 1).Value = "Test"
    8.     moWB.Sheets("Sheet1").Cells(1, 1).Copy
    9.     moWB.Sheets("Sheet2").Activate
    10.     moWB.Sheets("Sheet1").Paste Destination:=moWB.Sheets("Sheet2").Cells(1, 1)
    11. End Sub
    12.  
    13. Private Sub Form_Load()
    14.     Set moApp = New Excel.Application
    15.     moApp.Visible = True
    16.     Set moWB = moApp.Workbooks.Add
    17.     If moApp.EditDirectlyInCell = True Then
    18.         moApp.EditDirectlyInCell = False
    19.     End If
    20. End Sub
    21.  
    22. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    23.     If moApp.EditDirectlyInCell = False Then
    24.         moApp.EditDirectlyInCell = True
    25.     End If
    26.     moWB.Close False
    27.     moApp.Quit
    28.     Set moWB = Nothing
    29.     Set moApp = Nothing
    30. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Addicted Member SpeedyDog's Avatar
    Join Date
    Feb 2004
    Location
    Missouri, USA
    Posts
    189

    Re: Excel.. Exit Edit Mode

    This doesn't work?....

    goto sheet 2, and start typing in say 3,5 for example just type in randomness, don't exit out of edit mode... and then push Command1... it deosn't write text, or copy it until AFTER you exit out of edit mode :-/

    -SpeedyDog

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Excel.. Exit Edit Mode

    If you noticed that I have code in the Form_Load event to disable the edit
    capability. Then if the user tries to edit anything in Excel, it wont go into
    editmode.

    VB Code:
    1. Private Sub Form_Load()
    2.     Set moApp = New Excel.Application
    3.     moApp.Visible = True
    4.     Set moWB = moApp.Workbooks.Add
    5.     If moApp.EditDirectlyInCell = True Then
    6.         moApp.EditDirectlyInCell = False 'TURNS EDIT MODE OFF
    7.     End If
    8. End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    Addicted Member SpeedyDog's Avatar
    Join Date
    Feb 2004
    Location
    Missouri, USA
    Posts
    189

    Re: Excel.. Exit Edit Mode

    that doens't turn off Edit mode for my version of Excel? EXCEL XP version 10.x .... I even ended up taking out that if statement and just making it false.. and I can still edit :-/ But people need to beable to edit...

    I need to EXIT the edit mode, when they click the update...

    -SpeedyDog...

    P.S.
    Project DueDate for client is Monday :-/ (edit: wow, acutally not till the 1-10-2005)

    I mean, things work fine, just it hangs if they don't exit out of edit mode when they go to update, and since they are paying $3,000/month for this program I figured I should get that fixed :-P
    Last edited by SpeedyDog; Dec 31st, 2004 at 04:38 PM.

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Excel.. Exit Edit Mode

    So if I get it working for you do I get $3k???

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width