I needed to create userform for Project Tracker Sheet. I created a userform in excel and assigned the macro created
Code Inside UserForm for save:
Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim i As Integer
Set ws = Worksheets("Projects")
Dim lastRow As Long
lastRow = ws.Cells(ws.Rows.Count, "D").End(xlUp).Row
Dim textBoxes As Variant
textBoxes = Array(TextBox1, TextBox2, TextBox3, TextBox4, TextBox5, TextBox6, TextBox7, TextBox8, TextBox9, TextBox10, TextBox11, TextBox12, TextBox13, TextBox14, TextBox15, TextBox16, TextBox17, txtback, txtperson, txtstorage, txtwork, txtaccess, txtdoc, txtdoclink, txtadd)
For i = 0 To UBound(textBoxes)
ws.Cells(lastRow + 1, i + 4).Value = textBoxes(i).Value
Next i
' Clear TextBox values
For i = 0 To UBound(textBoxes)
textBoxes(i).Value = ""
Next i
End Sub
Code to Clear Data Entered:
Private Sub CommandButton2_Click()
Unload Me
UserForm1.Show
End Sub
Close UserForm:
Private Sub CommandButton3_Click()
Unload UserForm1
End Sub
Code to open image on initializing:
Private Sub UserForm_Initialize()
Dim imgPath As String
imgPath = "C:\Users\Nair.Ha\Downloads\logo.gif"
Me.Image1.Picture = LoadPicture(imgPath)
Me.Image1.PictureSizeMode = fmPictureSizeModeStretch ' Adjust the PictureSizeMode as desired
End Sub
Code to open userform:
Sub GraphicClick()
UserForm1.Show
End Sub
to one graphic visual. Now the macro is running in my computer properly.
Now I put the macro enabled Excel workbook to Sharepoint so my team members can use it.
But when they try to open the Excel using option Open Excel in Desktop, they aren't able to run the macro. They're getting Runtime error 76: Path not found.
I want the macro to run in all PC's.
I believe the problem is the path is saved in my pc even after uploading the file to sharepoint. I can't find the way to change the path.
Do I need to export the Userform file (.frm) to the same Sharepoint site and then try to import it from there?
Please help me I'm confused.
save logo.gif file next to the excel file and make this change to code
From
imgPath = "C:\Users\Nair.Ha\Downloads\logo.gif"
To
imgPath = ThisWorkbook.Path & "\logo.gif"