Results 1 to 7 of 7

Thread: [RESOLVED] Help to open a maco/userform without the...

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2004
    Location
    U.K
    Posts
    752

    Resolved [RESOLVED] Help to open a maco/userform without the...

    word file?

    Any help please?

    I have a word file, I want to open up this file, so the "enable macro" screen appears, after this i can get the userform to run straight away, but with that userform a word file opens (i think its the active document). Ive used open document function but i dont want the word file to run aswell.

    Is it possible for me to select the word file, maybe bypass the enable macro screen???? so the userform can run without the microsoft word file opening aswell?

    actually lol i dont think i can bypass the enable macro screen so forget that 1.

    thanks

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

    Re: Help to open a maco/userform without the...

    If you sign your documents vba project (macro code section) with a digital certificate you can set your security level to high s it will only trust from your signature tso to speak.

    You can not just show a UserForm with out the document. To do this you should use VB 6 or VB.NET etc.
    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

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Help to open a maco/userform without the...

    you can set the application to visible = false, then only the userform will show, remember you need to have ways to close or show the application when the userform is closed
    VB Code:
    1. Private Sub Document_New()  ' or open
    2. Application.Visible = False
    3. UserForm1.Show
    4. 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
    Fanatic Member
    Join Date
    Nov 2004
    Location
    U.K
    Posts
    752

    Re: Help to open a maco/userform without the...

    Quote Originally Posted by westconn1
    remember you need to have ways to close or show the application when the userform is closed[/Highlight]
    Thaks for the code it works a treat, but i do not understand what you mean by this part. IN the userform i do have a finish button, which basically gives the user the option of closing the userform, and if they select yes then the following code kicks in:

    me.unload

    Im not sure what your suggesting though, but if you could clarify id appreciate it.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2004
    Location
    U.K
    Posts
    752

    Re: Help to open a maco/userform without the...

    oh i understand now, i exit the program from the userform. And when i ran another userform on another project, both of the projects could be seen.

    What is the best way around this please? Would i use document close? but how could i relate that to my coding? its pretty obvious the me.unload is not going to work

  6. #6
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Help to open a maco/userform without the...

    you are only seting the word application to not visible, but it is still open and noone can see it to close it
    so during the close process for the userform you need to either make it visible again or close the application

    VB Code:
    1. Unload Me
    2. Application.Quit
    3. ' or   Application.Visible=True
    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

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2004
    Location
    U.K
    Posts
    752

    Re: Help to open a maco/userform without the...

    thanks alot westconn1, i preferred the first one as the true option opens up the document.

    your a great help, cheers

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