Using userform to add hyperlink

PuntingJawa

Board Regular
Joined
Feb 25, 2021
Messages
140
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I'm looking to add to my userform the function of adding a hyperlink. It looks like the image below.
1665774902557.png

I've been experimenting but haven't come up with anything functional at all. What I am attempting to do is when I enter in "Pack File Name" and enter the filepath to "Pack File Link" that it creates a hyperlink into "Range("N" & erow + 1)" with the pack file name. Per usual, I believe that I am overcomplicating in my attempts.
VBA Code:
'Private Sub PackFileLink_Change()
'File location for hyperlink
'End Sub

'Private Sub PackFileName_Change()
'File name
'End Sub

Private Sub RecDate_Change() 'Date

End Sub

Private Sub RecNCR_Change()
    RecNCR.Text = UCase(RecNCR.Text) 'NCR #
End Sub

Private Sub RecRMA_Change()
    RecRMA.Text = UCase(RecRMA.Text) 'RMA #
End Sub

Private Sub RecSupplier_Change()
    RecSupplier.Text = UCase(RecSupplier.Text) 'Supplier
End Sub

Private Sub RecProject_Change()
    RecProject.Text = UCase(RecProject.Text) 'Project #
End Sub

Private Sub RecDescription_Change()
    RecDescription.Text = UCase(RecDescription.Text) 'Item Description
End Sub

Private Sub RecPartNumber_Change()
    RecPartNumber.Text = UCase(RecPartNumber.Text) 'Part #
End Sub

Private Sub RecSlipQTY_Change()
    RecSlipQTY.Text = UCase(RecSlipQTY.Text) 'QTY on packing slip
End Sub

Private Sub RecCountQTY_Change()
    RecCountQTY.Text = UCase(RecCountQTY.Text) 'Actual QTY count
End Sub

Private Sub RecPackNumber_Change()
    RecPackNumber.Text = UCase(RecPackNumber.Text) 'Packing Slip #
End Sub

Private Sub RecPO_Change()
    RecPO.Text = UCase(RecPO.Text) 'PO #
End Sub

Private Sub UserForm_Activate()

RecDate.Text = Format(Now(), "MM/DD/YY") 'Auto date for today


End Sub
Private Sub ReceivingSubmit_Click() 'Command button submit

erow = Sheets("Receiving").Range("a" & Rows.Count).End(xlUp).Row 'Submit on next open "A" row
    Range("A" & erow + 1) = RecDate.Value 'Date
    Range("B" & erow + 1) = RecSupplier.Value 'Supplier
    Range("C" & erow + 1) = RecProject.Value 'Project #
    Range("D" & erow + 1) = RecDescription.Value 'Decription
    Range("E" & erow + 1) = RecPartNumber.Value 'Part #
    Range("F" & erow + 1) = RecSlipQTY.Value 'Packing slip QTY
    Range("G" & erow + 1) = RecCountQTY.Value 'Actual count QTY
    Range("I" & erow + 1) = "PS " & RecPackNumber.Value 'Pack Slip #
    Range("J" & erow + 1) = "PO " & RecPO.Value 'Purchase Order #
    Range("K" & erow + 1) = RecNCR.Value 'NCR #
    Range("L" & erow + 1) = RecRMA.Value 'RMA #
    ThisWorkbook.Save

End Sub

Private Sub ReceivingClear_Click()
    RecSupplier.Value = "" 'Supplier
    RecProject.Value = "" 'Project #
    RecDescription.Value = "" 'Decription
    RecPartNumber.Value = "" 'Part #
    RecSlipQTY.Value = "" 'Packing slip QTY
    RecCountQTY.Value = "" 'Actual count QTY
    RecPackNumber.Value = "" 'Pack Slip #
    RecPO.Value = "" 'Purchase Order #
    RecNCR.Value = "" 'NCR #
    RecRMA.Value = "" 'RMA #

End Sub
 
Well if that's where it's throwing an error, that would suggest that perhaps you don't have a worksheet called Receiving in that workbook? What's the error number and the error message?
You were correct. I had Receiving slightly off.
Now I have a runtime error at
VBA Code:
         FullFilePath = FOLDERPATH & PackFileName.Text & ".PDF" 'Links folder path and pack file name as .pdf

Edit: I have double checked the filepath and all is correct.
1667568961671.png
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Well, that now tells me that you've since changed the name of the textboxes, and you now don't have a textbox with the name, PackFileName.

If you've gone off and changed the code or the names of things since you originally made the post, that's fine, but I do then expect you to at least read the code solutions I provide, and then make the necessary adjustments. I'm not psychic.
 
Upvote 0

Forum statistics

Threads
1,216,526
Messages
6,131,187
Members
449,631
Latest member
mehboobahmad

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top