• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

InfoPath and VB code assistance

Question

Brandon H    3,111

Hello fellow Neowinians in the programming section.

 

I am creating an InfoPath 2010 form for use at my work and am needing a bit of assistance.

 

I am trying to create a button that when clicked opens a specific file. I am pretty sure I need to add some VB code to the button to achieve this but I have never messed with Visual Basic before.

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0
Ice_Blue    983

If the file is an executable (.exe), attach the following code to the OnClick event of the button:

 

Private Sub cmdCalculator_Click()
    Dim RetVal
    RetVal = Shell("CALC.EXE", 1)     ' Run Windows Calculator.
End Sub

 

Share this post


Link to post
Share on other sites
  • 0
Brandon H    3,111

in this case I'm actually just trying to open another infopath form. would that be possible with similar code?

 

Here's a bit of the backstory. Where I work they have a hook in our notation program to an infopath form that acts as our quick notes utility (click the button of the procedure and it posts the notes). We also have a few other forms we use for ticket submission to certain email groups. I am one of the people that has access to update and maintain the main quick notes infopath form, what I'd like to do is add a couple of buttons within the quick notes form to open our secondary forms.

Share this post


Link to post
Share on other sites
  • 0
Ice_Blue    983

I do not have any experience with Infopath. However, I believe similar code will work.

 

Is the notation program on the same workstation as the Infopath form? I ask because if it isn't, the code will have to be amended to deal with a UNC file path.

 

I will look into it and see what I can do.

 

Edit: I am not receiving forum notifications, so I have to manually check my posts for responses.

Edited by Ice_Blue

Share this post


Link to post
Share on other sites
  • 0
Brandon H    3,111

the notation program as well as the infopath forms are located on a network drive but the drive is assigned the same letter for everyone so I don't believe that portion should be an issue

Share this post


Link to post
Share on other sites
  • 0
Brandon H    3,111

bump

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.