PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Excel Automation Error-VBForums
Results 1 to 6 of 6

Thread: Excel Automation Error

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2020
    Posts
    4

    Resolved Excel Automation Error

    Automation error when loading the userform. If i use fresh excel file first 1 -2 times the vba will run afterwards the file won't open and shows automation error and closes. I can't understand where the problem is. Can anyone help.

  2. #2

    Thread Starter
    New Member
    Join Date
    May 2020
    Posts
    4

    Re: [RESOLVED] [Excel 2010] Automation Error when creating SaveAs file dialog

    Quote Originally Posted by nO_OnE View Post
    I am glad you got it working!



    The debugger catches errors in the portion (Sub or Function) of your code that it is currently running through. If that portion of the code refers to another Function or Sub, and there is an error in that function it will not give you a normal debugging error.
    Technically there is not really a problem with your code, just how you used it. When you call
    vb Code:
    1. Application.FileDialog
    that is actually running a code that is built into the applcation, which is giving an error because you are attempting to do a save when nothing exists.
    https://www.experts-exchange.com/que...html#a39700403

    The file can be downloaded from below link:

    https://drive.google.com/open?id=1uF...qZl-RoLta2UEoo

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,852

    Re: [RESOLVED] [Excel 2010] Automation Error when creating SaveAs file dialog

    you should have started a new thread for this problem

    try like
    Code:
    Private Sub Workbook_Open()
    'Application.Visible = False
    Application.OnTime Now + TimeSerial(0, 0, 1), "openme"
    End Sub
    in any module
    Code:
    Public Sub openme()
    UserForm1.Show
    End Sub
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2020
    Posts
    4

    Re: [RESOLVED] [Excel 2010] Automation Error when creating SaveAs file dialog

    Quote Originally Posted by westconn1 View Post
    you should have started a new thread for this problem

    try like
    Code:
    Private Sub Workbook_Open()
    'Application.Visible = False
    Application.OnTime Now + TimeSerial(0, 0, 1), "openme"
    End Sub
    in any module
    Code:
    Public Sub openme()
    UserForm1.Show
    End Sub
    No sir, this also didn't helped. If i don't automate the user form while opening also then also it shows automation error. So the problem is not in opening the userform with workbook but in the initiate the userform.

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2020
    Posts
    4

    Re: [RESOLVED] [Excel 2010] Automation Error when creating SaveAs file dialog

    Quote Originally Posted by westconn1 View Post
    you should have started a new thread for this problem

    try like
    Code:
    Private Sub Workbook_Open()
    'Application.Visible = False
    Application.OnTime Now + TimeSerial(0, 0, 1), "openme"
    End Sub
    in any module
    Code:
    Public Sub openme()
    UserForm1.Show
    End Sub
    https://youtu.be/8peRpBdCq-o

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,852

    Re: [RESOLVED] [Excel 2010] Automation Error when creating SaveAs file dialog

    i have problem with opening the userform, excel just crashes, but no error message at all
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width