Can I open two pdf documents using visual basic 2008 with just one menu click? - vb.net

I have a common.vb member that contains a number of different links (menu) to various forms or to a pdf. One link (Bidding Opportunities) currently opens one pdf. I need for that link to open another pdf in a separate window just like the current one. In other words two separate pdfs in two separate windows. Everything I've tried so far has not worked. Any help is greatly appreciated.
Current Code Example=
Dim MenuItem17 As String = "<a href='" & "http://docs.birminghamal.gov/landbank/RFPforLegalServicesforBLBAQuietTitleActions.pdf" & " ' target='_blank'>" & "Bidding Opportunities" & "</a></br><br>"

Related

I'm trying to create a header that begins on the second page, inserts an em dash, the page number and another em dash, centered in vba

document.Application.ActiveDocument.Sections(1).Headers(WdHeaderFooterIndex.wdHeaderFooterPrimary) _
.PageNumbers.StartingNumber = 2
For Each section As Word.Section In document.Application.ActiveDocument.Sections
Dim headerRange As Word.Range = section.Headers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range
headerRange.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
headerRange.Text = " — "
headerRange.Fields.Add(headerRange, Word.WdFieldType.wdFieldPage)
headerRange.Text = headerRange.Text & " — "
Next
The issue that I am having is I cannot get the dashes on either side of the page number. It will always place both of them before or after the page number.
I have tried concatenating, I have tried various placements of the dashes. I have tried the headerRange.Collapse with no success.
'document.Application.ActiveDocument.Sections(1).Headers(WdHeaderFooterIndex.wdHeaderFooterPrimary) _
' .PageNumbers.StartingNumber = 2
'For Each section As Word.Section In document.Application.ActiveDocument.Sections
' Dim headerRange As Word.Range = section.Headers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range
' headerRange.Text = "—"
' headerRange.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter
' headerRange.Collapse(Word.WdCollapseDirection.wdCollapseEnd)
' headerRange.Fields.Add(headerRange, Word.WdFieldType.wdFieldPage)
' headerRange.Collapse(Word.WdCollapseDirection.wdCollapseEnd)
' headerRange.Text = "-"
'Next
To a man with a hammer, everything looks like a nail.
You are doing this the hard way, in my opinion.
I look at using a macro for this as reinventing the wheel - Instead, use Templates or Building Blocks
Perhaps I am lazy, but setting things up in vba and formatting it is hard, at least to me.
You could create a template with your header and use that as the basis for new documents. Here is my page on Templates in Microsoft Word.
You could save this as a Building Block if you want to use it in existing documents. Remember that using a page number building Block for top of page replaces any existing header, for bottom of page replaces any existing footer.
Here is a temporary link to a template containing three page number building blocks with those for top and bottom of the page being centered. All have M-dashes on either side. The font and size will be determined by the Header or Footer styles in the document. The template contains instructions for using it.
If you want to use vba to insert these building blocks, there are examples shown on my web page with specific instructions on placement of the macros and building blocks. Here is my answer here about using vba to insert a Table of Contents a Building Block.
You could also have a macro to create a new document based on your template.
No matter how you decide to do this, keep in mind that each Word section has three headers, whether or not they are seen. In multi-section documents, these may, or may not, be linked to like headers in previous sections.
Here is my recap of Header and Footer Settings.

VBA MS Access TextBox

I am pretty new to VBA , trying to develop an application using MS Access forms. I have been struggling to display formatted text in a Text box.. Here is what am stuck with..
I have two text boxes , where i would like to grab the text from the two boxes and display in a third text box in two lines.[third text box i would like to use to hold multiple lines , so i have set the Scrollbar value to 'Vertical'). Below is the code
MsgBox Me.Text0.Value & vbNewLine & Me.Text2.Value // This works , displaying in two lines
Me.Text4.Value = Me.Text0.Value & vbNewLine & Me.Text2.Value //THIS DOES NOT WORK , ANY ISSUE WITH MS ACCESS TEXTBOX PROPERTY SETTING?
Please help me on this. Not sure what am doing wrong.. My apologies if this has been answered earlier in another thread , i tried many different attempts in my code but clueless.
just figured it out.. I had the property set the "Rich text format" , I made that to "Plain Text" it worked. :-)

How to use multiple textbox entries in part of a url in vb?

I'm making a visual basic program, and I'm trying to make a button go to a link, but two parts of the link need to come from text boxes. I know how to make it go to the url in the text box entry, but I need to know how to make it go to a preset url, only with two parts of the url coming from text box entries.
I tried ("example.com/test?ex="(TextBox1.Text)"?nl="(TextBox2.Text))
and that didn't work. Please help
Thanks!
Process.Start("example.com/test?ex=" & TextBox1.Text & "?nl=" & TextBox2.Text)
Or, in Visual Studio 2015 you can use Interpolated Strings:
Process.Start($"example.com/test?ex={TextBox1.Text}?nl={TextBox2.Text}")
String.Format version.
Process.Start(String.Format("example.com/test?ex={0}?nl={1}",TextBox1.Text,TextBox2.Text))

How to keep all webclient text in one line in Skype?

I'm having a issue with visual basic 2012 Webclients. I'm trying to gather information from a website. Then upload it to a Skype chat. On the website, the text goes in separate lines. Example:
Hello.
How Are You?
Good Thanks.
When I run the application, it displays the text in a odd way. It displays it like this:
<br>Hello<br>how are you&<br><br>good<br>
Here is the code. (This project is based around a Skype Bot, So I will need to blank out the api for this.)
ElseIf msg.StartsWith("cloudflare ") Then
c.SendMessage("SkypeBot >" + vbNewLine +
("" + New WebClient().DownloadStringTaskAsync("api" & msg.Replace("cloudflare ", ""))))
The issue is based around .DownloadStringTaskAsync I believe. Help with this issue will be highly appreciated.
EDIT: I also know about "You need to use HTML on a web page to get line breaks. For example "" will give you a line break."
but I'm unsure where to insert it and how to use it in that code.
My VB.NET knowledge is a little rusty, but can you not use something like this (C# code):
string[] arrayOfText = welcomeText.split("<br>");
Then you can do whatever you want with the text. Stick it back together, but with spaces instead of < br>
Alternatively you could use the .replace function?

Different PPT templates reacting different on the same macros

I'm new here, so I might have not seen a possibility to upload my problem files, which would make it easier to describe the problem.
Edit: The files a here: https://drive.google.com/file/d/0B--IbmtX58h8TnVrdlRyUXZ5a2dEOVJBQkplVjFuVEVMVXhJ/view?usp=docslist_api
and: https://drive.google.com/file/d/0B--IbmtX58h8TFR6d3FkWlZpSGFVUGF5bHVhRTR5ZTlnbXAw/view?usp=docslist_api
(Thank you for the idea, Steve)
What it is about:
I have two documents with different master templates reacting completely different on the same set of macros and I have no idea how and why this can happen and how to repair or avoid it.
Two of the macros just create objects - one is a single textbox, the other one a group of a rectangle and a textbox . The first mentioned appears on the position defined in the code in one of the templates, but a bit below it in the other one. Even more strange is the behavior of the group. The rectangle appears on the correct position in both of the templates, the textbox only in one of it.
Next is a macro for increasing the paragraphing between text lines by 3 pt. It works fine in one template, but in the other template it increases the spacing by 43.2 pt!
Macro number four is made to set back the paragraphing space after back to 0. This one works fine in both templates.
Funny enough, the mistakes appear in opposite to each other. The single textbox and the group produce their error in the template, where the spacing tool works fine, and the spacing tool does strange things in the template where the single textbox and the group work well.
Any idea will be appreciated!
Thanks,
RG
I work with PowerPoint 2010.
Your footnote is getting misplaced because the default text settings in one presentation are different from those in the other; in this case the auto fit setting.
' in this section of your FOOTNOTE routine:
With .TextFrame
' Add this next line and it will work as expected
.AutoSize = ppAutoSizeNone
.TextRange.Text = "Note: " & vbCrLf & "Source: "
.VerticalAnchor = msoAnchorBottom
Likewise, in your SectionMarker subroutine:
With .TextFrame
' add this
.AutoSize = ppAutoSizeNone
' then the rest of your code
Then it all works as you'd expect. Or at least, it works the same with both templates.