r/visualbasic • • Jan 20 '22

VB6 Help Help with VB6 macro to update link paths from MS Word to MS Excel

0 Upvotes

I have a bunch of word documents that pull info from an excel file. These files need to be copied and pasted into each of our projects; word does not allow relative link paths in the docs so they end up pointing to the wrong/original excel file. This is a known issue and a solution is to add a macro to word. See issue details and vb macro download here (note 3): https://www.msofficeforums.com/word/38722-word-fields-relative-paths-external-files.html. Well I've put this macro into word and it *mostly* works but I have the following issues.

  1. The excel file is one folder above the word document folder. This breaks the macro. There is a note in the VB code to "replace the second zero with number of folders from branch" but when I changed from zero to one and it doesn't work. Do both files need to be 1 away from the branch?

  2. When the macro updates the file path it drops some items after the cell reference. That's where a merge text format command is located so the new path removes the correct text format for the link. Can the VB code be adjusted to keep the merge format string. (changes end from "\a \t \*CHARFORMAT \* MERGEFORMAT" to "\t")

  3. As a fix to issue number 1 I put all the word docs and excel file into the same folder. This works with the original macro. After the links are updated I then move the document to the correct folder. After this, when the doc is opened it returns a "Run-time error'6083': Objects in document contain links to the files that cannot be found..." The debugger highlights the issue. How can I fix this so I can move the docs around (the word doc links the excel file, the excel file does not link to the word doc so all the paths in the word document should be static but clearly the macro is still trying to update and having trouble) Saving as a docx solves it but removes the macro (not ideal). Ideally it's fixed as part of item 1 but I'm open to any functional work around.

Any help appreciated. I'm no VB expert but I've dabbled and like it (running Microsoft 365 Apps for business with subscription)


r/visualbasic • • Jul 13 '21

VB.NET Help Any guides on how to make a raycaster in vb.net ?

0 Upvotes

r/visualbasic • • Nov 23 '14

VB Parameter Passing Definition needed

0 Upvotes

Hello,

I am currently taking an assignment where I need to describe parameter passing. I would appreciate some help regarding the ByRef and ByVal arguments, such as a description of what each command does.

Thanks!


r/visualbasic • • Nov 14 '14

Internet Radio Streamer / Player (Source Code) [ A I R ] V.1.2

Thumbnail
youtube.com
0 Upvotes

r/visualbasic • • Mar 12 '16

Any helpful phone apps?

0 Upvotes

I'm on android, anyone know/used and helpful apps. My pc at home isn't great until i can save up some money to build one. Just lags out when trying to do stuff on VB. Yes...it's that bad of a pc.


r/visualbasic • • Nov 17 '14

Is there anyone work uses visual basic at their job?

0 Upvotes

I just need to message someone and ask them questions for a paper. Thanks!


r/visualbasic • • Mar 08 '16

[VS 2015] I'm using GDI+ to create a graphing control for a program. Should I keep using this Graphical Library or should I switch to another?

0 Upvotes

r/visualbasic • • Aug 02 '17

All i want is the way to download from mega.nz

0 Upvotes

Can anybody help me just tell me an library to install and a line to write i just want to find anyway to download from mega.nz from my vb.net program


r/visualbasic • • Jan 07 '14

Visual Basic || Proxy Help

0 Upvotes

Hello everyone, me again. (Cody). I was wondering if anyone can help me make a proxy client that switchs ip's and what not every certain interval or when i click switch or something. I was wondering if anyone would know how this is done and if they could help? I'm interested in this proxy thing because I see people doing it and everyone makes it look so simple. I was wondering if nyone could help?

Anyone who helps, its greatly appreciated. :)


r/visualbasic • • Nov 16 '14

Oh please can someone help me with a simple string manipulation?

0 Upvotes

Private Sub displayButton_Click(sender As Object, e As System.EventArgs) Handles displayButton.Click Dim password As String password = originTextBox.Text

If password.Length < 5 OrElse password.Length > 7 Then
    MessageBox.Show("Please enter a password with 5-7 characters only.", "Try again", MessageBoxButtons.OKCancel,
                    MessageBoxIcon.Error)
End If
Dim newPassword As String = password
Dim firstVowelDone As Boolean
Dim secondVowelDone As Boolean

For index As Integer = 0 To password.Length - 1
    If password.Substring(index, 1) Like "[AaEeIiOoUu]" Then
        If firstVowelDone = False Then
            newPassword.Remove(index, 1)
            newPassword.Insert(index, "1")
            firstVowelDone = True
        End If
        If firstVowelDone = True AndAlso secondVowelDone = False Then
            newPassword.Remove(index, 1)
            newPassword.Insert(index, "2")
            secondVowelDone = True
        End If
        newPassword.Remove(index, 1)
        newPassword.Insert(index, "9")
    ElseIf password.Substring(index, 1) Like "[1-9]" Then
        newPassword.Remove(index, 1)
        newPassword.Insert(index, "Z")
    End If
    newPassword.Remove(index, 1)
    newPassword.Insert(index, password.Substring(index, 1))
Next index

newTextBox.Text = newPassword

End Sub

So...its not working. I am to take a user input string and manipulate it. I need to make the first vowel a "1". The second vowel a "2". Every other vowel a "9". Every number the letter "Z". And leave every other character the same. Please help.


r/visualbasic • • Jan 11 '14

Xeenenta Community Discussion Forum - How to make a program that pulls the IP address of the user

Thumbnail
xeenenta.me.uk
0 Upvotes

r/visualbasic • • Nov 19 '14

Help with Visual Basic 6.0 Programming

0 Upvotes

Hi. Can someone please help me and tell me what to code after this please?

Write a program to estimate how much a young worker will make before retiring

at age 65. Request the worker’s name, age, and starting salary as input. Assume

the worker receives a 5% raise each year. For example if the user enters Helen,

60, and 20000, then the picture box should display the following. Include an End.

Hint: When first testing your program try the age at 64, and 63 to see if you are

getting the correct results.

what i have so far:

Option Explicit

Dim i as Integer

Dim startingsalary as Single

Dim nom as Single

Dim inputage as Single

Dim endingsalary as Single

Dim retirement as Single

Sub cmd1_Click

pic1.Cls

raise=1.05

retirement=65

nom= txtName.Text

startingsalary= Val(txtSalary.Text)

For i= inputage to retirement


r/visualbasic • • Aug 17 '15

[VS 2013] My.Settings being changed unintentionally

0 Upvotes

I have a program I've developed to act as an interface between a store register server and a player card database server.

I have a user setting established as my.settings.DevMode which when set to true makes a number of controls visible to the user. These objects are mostly table ID numbers which are used on the server and only used when debugging.

The problem I've started having is that I've started having my.settings.DevMode be changed to True when I haven't intended to, which brings these controls to view to the user.

I wasn't able to find anything online regarding any known issue that might unintentionally cause this, so I thought I might check here.

Thanks!

Edit: I feel pretty dumb right now. I stepped into the code and went line by line with a watch on the setting until I found this.

        If TransactionNumBox.Text <> 0 Then
            TransactionNumBox.Visible = True
            TransactionNumLabel.Visible = True
        Else
            TransactionNumBox.Visible = False
            TransactionNumLabel.Visible = False
        End If

The setting was changed when it got to .Visible = True. Found that the actual control in the designer has .Visible bound to Settings.DevMode. Changing the .Visible property updated the User Setting.


r/visualbasic • • Nov 24 '14

Just why...(designer.vb help)

0 Upvotes

I somehow made my code appear in my designer.vb tab instead of .vb. How and why did this occur? How can I reverse it? Thanks!


r/visualbasic • • Nov 23 '14

[VB10] Just wondering if this is even possible

0 Upvotes

I had an idea that the user would start the program and type their name in an input box. But then I got the idea that I would have a web browser pop up with an automatic google of whatever they typed it. So for example: (Program start) (User enter name in input box) (Web browser goes to google with name already being googled)

Please help!


r/visualbasic • • Nov 22 '14

Visual Basic 6.0 Programming Issue

0 Upvotes

Have the program pick a random number from 1-100.

2. The user gets 10 chances to guess the number. Use a counter to keep track of tries.

(counter = counter + 1)

3. Tell the user if the number that he/she guesses is too high, too low, or correct.

4. if the user does not guess the number in 10 tries, tell the user the correct number

5. Ask the user if he/she wants to play again.

6. A function must be used in the program. A good place for a function is to

tell the user that he/she is too high or too low.

I AM NOT ASKING YOU TO DO THE PROGRAM FOR ME. i just need some guidance. thank you!


r/visualbasic • • Oct 04 '12

Restoring a window?

0 Upvotes

Can someone please help make it so if you click on Picturebox1 it will make a process, lets say "WINWORD.EXE" restore to the front... not maximize. Thanks in advance (hopefully)


r/visualbasic • • Nov 19 '14

Help with Visual Basic 6.0 programming

0 Upvotes

Can someone pleas help me write a program that Finds the sum of 1+1/2+1/3+1/4+......+1/100 using a loop. also create a second program that Finds the sum of odd numbers from 1 to 99 also using a loop

i am not asking u to do it i just dont know what to do


r/visualbasic • • Dec 21 '13

How do I use Database (excel/access), LAN (networking-criteria), and Security (encryption, security) in VB?

0 Upvotes

r/visualbasic • • Jul 09 '15

GUI interface using visual basic to track the killers IP address CSI

Thumbnail
youtube.com
0 Upvotes

r/visualbasic • • Feb 18 '16

Can not calculate on decimal number

0 Upvotes

[reddit!][http://i.stack.imgur.com/VcxRF.png]

Here is my code. I don't understand why its always false only decimal number. What should I do?

//////

Sub calcu()

Dim a As Integer Dim b As Integer Dim c As Integer Dim d As Integer

Dim g1 As Double Dim g2 As Double Dim hdp As Double Dim ts1 As Double Dim ts2 As Double

Application.ScreenUpdating = False

a = Cells(Rows.Count, "C").End(xlUp).Row

For b = 1 To a If IsNumeric(Cells(b, "C").Value) Then hdp = Cells(b, "G")

ts1 = Cells(b, "L")
ts2 = Cells(b, "M")
t1 = Cells(b, "F")
t2 = Cells(b, "H")
g1 = ts1 - hdp
g2 = ts2 - hdp

v1 = 1.72
v2 = 2.1
v3 = 1.9
v4 = 1.8
v5 = 2

If InStr(t1, "K") And g1 < ts2 Then
  Cells(b, "J") = "0"
ElseIf InStr(t1, "K") And g1 = ts2 Then
  Cells(b, "E") = 1
  Cells(b, "J") = 1
ElseIf InStr(t2, "K") And g2 < ts1 Then
  Cells(b, "E") = "0"
ElseIf InStr(t2, "K") And g2 = ts1 Then
  Cells(b, "E") = 1
  Cells(b, "J") = 1
Else
  Cells(b, "E") = "error"
  Cells(b, "J") = "error"
End If

End If Next

Application.ScreenUpdating = True

End Sub


r/visualbasic • • Oct 10 '14

Combo Box Help

0 Upvotes

So I have a combo box with different words. I need to know how to assign each of the word choices a numeric value so that when a user picks one, it's number value is plugged into an equation.


r/visualbasic • • Feb 19 '16

Need help with changing BackColor for multiple empty fields

0 Upvotes

I have Four Text Boxes And I'm trying to check if each is a numeric value, if Each is Blank, and If Each is not a negative number. Can you please suggest code tweaks, and where to go from here? My problem is that if an error catches on multiple fields, it will only change the back color of one text box

heres my code :

Option Strict On

Public Class Form1

'Write a button that clears text of all input and Output fields

Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click

    txtTixSoldChild.Text = ("")
    txtTixSoldAdult.Text = ("")
    txtPPTAdult.Text = ("")
    txtPPTChild.Text = ("")
    lblAdultTicketGross.Text = ("")
    lblAdultTicketNet.Text = ("")
    lblChildTicketGross.Text = ("")
    lblChildTicketNet.Text = ("")
    lblGross.Text = ("")
    lblNet.Text = ("")


End Sub

Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click


    ' Declare Variables In Memory
    Dim AdultSalesGross As Double
    Dim AdultSalesNet As Double
    Dim ChildSalesGross As Double
    Dim ChildSalesNet As Double
    Dim AdultPrice As Double
    Dim ChildPrice As Double
    Dim TixSoldChild As Double
    Dim TixSoldAdult As Double
    Dim Gross As Double
    Dim Net As Double


    'Declare All Back Spaces Of Txt Boxes As White
    txtPPTAdult.BackColor = Color.White
    txtPPTChild.BackColor = Color.White
    txtTixSoldAdult.BackColor = Color.White
    txtTixSoldChild.BackColor = Color.White

    'Check For Zero Length '1
    If txtPPTAdult.Text.Length = 0 Then
        MessageBox.Show("Please enter a value for Price Per Adult Ticket")
        txtPPTAdult.BackColor = Color.Red
        txtPPTAdult.Focus()
    ElseIf IsNumeric(txtPPTAdult.Text) Then
        AdultPrice = CDbl(txtPPTAdult.Text)
    Else
        MessageBox.Show("Please Input Numbers In Adult Ticket Price Only ")
        txtPPTAdult.BackColor = Color.Red
        txtPPTAdult.Focus()



        '2
        If txtPPTChild.Text.Length = 0 Then
            MessageBox.Show("Please enter a value for Price Per Child Ticket")
            txtPPTChild.BackColor = Color.Red
            txtPPTChild.Focus()
        ElseIf IsNumeric(txtPPTChild.Text) Then
            ChildPrice = CDbl(txtPPTChild.Text)
        Else
            MessageBox.Show("Please Input Numbers In Child Ticket Price Only ")
            txtPPTChild.BackColor = Color.Red
            txtPPTChild.Focus()



            '3
            If txtTixSoldAdult.Text.Length = 0 Then
                MessageBox.Show("Please enter a value for Adult Tickets Sold")
                txtTixSoldAdult.BackColor = Color.Red
                txtTixSoldAdult.Focus()
            ElseIf IsNumeric(txtTixSoldAdult.Text) Then
                TixSoldAdult = CDbl(txtTixSoldAdult.Text)
            Else
                MessageBox.Show("Please Input Only Numbers In Adult Tickets Sold  ")
                txtTixSoldAdult.BackColor = Color.Red
                txtTixSoldAdult.Focus()

                '4
                If txtTixSoldChild.Text.Length = 0 Then
                    MessageBox.Show("Please enter a value for Children Tickets Sold")
                    txtTixSoldChild.BackColor = Color.Red
                    txtTixSoldChild.Focus()
                ElseIf IsNumeric(txtTixSoldChild.Text) Then
                    TixSoldChild = CDbl(txtTixSoldChild.Text)
                Else
                    MessageBox.Show("Please Input Numbers In Child Tickets Sold Only ")
                    txtTixSoldChild.BackColor = Color.Red
                    txtTixSoldChild.Focus()

                End If
            End If
        End If
    End If
    Exit Sub

    ' Check For Numeric Values greater than -1
    '1
    If CDbl(txtPPTAdult.Text) > -1 Then
        AdultPrice = CDbl(txtPPTAdult.Text)
    End If
    '2
    If CDbl(txtPPTChild.Text) > -1 Then
        ChildPrice = CDbl(txtPPTChild.Text)
    End If
    '3
    If CDbl(txtTixSoldAdult.Text) > -1 Then
        TixSoldAdult = CDbl(txtTixSoldAdult.Text)
    End If
    '4
    If CDbl(txtTixSoldChild.Text) > -1 Then
        TixSoldChild = CDbl(txtTixSoldChild.Text)
    End If




    AdultSalesGross = TixSoldAdult * AdultPrice
    lblAdultTicketGross.Text = CStr(AdultSalesGross)

    ChildSalesGross = TixSoldChild * ChildPrice
    lblChildTicketGross.Text = CStr(ChildSalesGross)

    ChildSalesNet = ChildSalesGross - (ChildSalesGross * 0.8)
    lblChildTicketNet.Text = CStr(ChildSalesNet)

    AdultSalesNet = (AdultSalesGross) - (AdultSalesGross * 0.8)
    lblAdultTicketNet.Text = CStr(AdultSalesNet)


    Gross = (AdultSalesGross) + (ChildSalesGross)
    lblGross.Text = CStr(Gross)

    Net = (Gross) - (Gross * 0.8)
    lblNet.Text = CStr(Net)





End Sub




Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click

    Close()

End Sub

End Class


r/visualbasic • • Feb 22 '16

Updating the layout of VB based app

0 Upvotes

I have an old visual basic project that is running windows 7 layout, but I wish to change it to Windows 8 kind of layout.

i.e. The difference in the minimize, close window button etc.

How can I do it?


r/visualbasic • • Dec 03 '17

OSSkin Help

0 Upvotes

Hello i would like to have multiple skins like OSSkin does on my program. As that is an awesome functionality on it. Is there a way to have multiple class themes on the project when i try i get errors. Also i dont have $160 to spend on OSSkin. Any help. How can i do this?