Accquiring network location of a Infopath form using vba - vba

I have a network published infopath 2010 form.
I would like this form to display the actual network location it is located in when it loads directly in the form. Right now, the form location is displayed at the bottom of the screen as a part of the Infopath window.
I know how do to do everything else besides getting the network file location using vba. Any ideas? As far as I can tell I can only pull the URI of the form which is specific to SharePoint deployments not Network deployment.
Any ideas would be greatly appreciated! :)

I ran a quick test and found that when I opened a network published template, this code:
this.Template.Uri.ToString()
Returned the published location in this format:
file:///D:/Documents/Temp/test.xsn
So, you'd need to clean the string up a bit - but this appears to work with network published templates. Were you getting a different result?

Related

Windows defender removing vba code from Word Document

We have a large word application with around 100 forms, 50 modules and 20 classes. Over 100 people get into this application and some of them are seasonal which means that they will use different computers. We are running into an issue where windows defender seems to be removing the the vba from the word document. It seems to only happened every once in a while and we believe it is with someone new to the application. Each time it occurs, the file is broken and we have to use our copy to save over the original version. The size of the file will go from 6,897KB to like 60KB. Below are screen shots that I was able to get from one user that caused this issue. Any assistance on how to prevent this from happening would be greatly appreciated.
This is the first error the user receives when they try to open the word document:
This is the error that the user receives after they click on the "First Error":

VB.NET - Export hidden form as application.

It is possible to export one hidden form as a fully application including icon?
Form example I have two forms, the main one with one button and the hidden one with a message box on loading event. What I want is after the button from first form is pressed the hidden from (form2) to be built as a standalone application in a path selected by me with an icon from a selected path or from resources.
If this is impossible I heard about one method where you first create an application, then you combine the code from something1.vb and something2.vb, then you can use them to compile in another application.
Sorry for this bad explained request. Thank you so much!
No. It´s not possible to compile code at runtime - if I understood what you need.
You can at maximum:
1 - Create an EXE application and ZIP it.
2 - In your 1st form, unzip the application into a folder.
But certainly you will have troubles with antivirus and, in the best situation, in your unziped application since it wasn´t correctly installed.

Location of Infopath Custom Code on SharePoint

I have an Infopath 2010 form that's been developed for a document library in SharePoint 2010. The form contains custom VB code, which is saved on a shared drive.
However, should the VB project on the shared drive get deleted/damaged/forgotten about, is there a way to retrieve the custom code from SharePoint itself? I know you can go to Library Settings>Advanced Settings>Document Template>Edit Template to retrieve the Infopath form, but when you attempt to edit the custom code, Infopath asks for the VB project location.
Does a plain-text, uncompiled version of the code get stored somewhere in SharePoint when the form is deployed?
When I have needed to get the code for a form and don't have access to original code files, one approach I have taken is to save the form as source files (either unzipping the template with a tool like 7-zip or from the publish menu in InfoPath in design mode) and then decompiled the code DLL with ILSPY. Imperfect & a bit of a pain, but has allowed me to see what may be going on in a template file and recreate the source code when needed.
Found my own answer - looks like I'd be out of luck.
http://www.bizsupportonline.net/blog/2013/recover-make-changes-infopath-forms-sharepoint.htm
Paragraph at the bottom just before "3 ways you can find out whether code was written for a form template"
That's a pretty helpful feature, Infopath...

Form won't open in Sharepoint Designer 2010

I'm using Sharepoint Designer (2010) to develop a series of connected lists.
I have a number of child-lists and I use the "DispForm.aspx" of my main list to add these 'children'.
Recently the DispForm.aspx has stopped opening in Sharepoint Designer. Clicking it from the list's main page goes into the Form view, but the page never loads and I get no error messages.
Since I can't see the Code window I can't make any changes, even though the page works fine in the browser and I can perform (limited) edits directly on the website through Sharepoint.
Has anyone got any tips on what I could try, or any way of accesing the code in DispForm.aspx if I can't open it in Sharepoint Designer?
Not a fix as such, but I got around this by mapping a drive to the sharepoint site and using notepad++ to edit the file directly.
If you browse the lists folder and the list you are interested in you will see the display, new, edit forms in there
S

Display HTML page in Office 2003 or 2007 task pane via VBA

Is it possible to display an HTML page in an Office 2003 and/or 2007 task pane via VBA?
Background: We have a complicated configuration file that our users maintain in Word (using a real editor is not an option for our audience).
We would like to create several toolbar buttons that display a basic HTML page in a task pane as a form of online help for our users.
The reason we want to use a task pane to display help (vs. an external browser or traditional help engine) is so that the help content is "embedded" in Word vs. displayed via a seperate application. The problem with using a regular browser or help engine to display help is that users have to manually size and position both applications so that they can see them simultaneously and its very easy to "lose" one application when togging between many applications.
We don't want to go down the route of writing a VisualStudio based task pane component - we want to keep things simple (KISS) and encapsulate everything in an easy to distribute Word template file (.dot or dotx.).
Suggestions?
Yes it is possible, see this blog for detailed steps in creating the custom task pane in Excel 2007.
http://blogs.msdn.com/gabhan_berry/archive/2008/08/13/custom-task-panes.aspx