Gif as a command button

wadiok

New Member
Joined
Jun 13, 2010
Messages
20
How do I make a gif as a command button I placed it with assign macros already this is the code I want to run how do I do it? Its way beyond me

Sub Picture1Click_()
'Grap username into first sheet

Range("a1").Value = WinUsername()
End Sub

Private Declare Function WNetGetUSer Lib "mpr.dll" Alias "WNetGetUserA"_
(ByVal IpName As String, ByVal IpUserName As String. IpnLength As Long) As Long

Private Const NO_ERROR = 0
Private Const ERROR_NOT_CONNECTED = 2250&
Private Const ERROR_MORE_DATA = 234
Private Const ERROR_NO_NETWORK = 1222&
Private Const ERROR_EXTENDED_ERROR = 1208&
Private Const ERROR_NO_NET_BAD_PATH = 1203&

Function WinUsername() As String
Dim strBuf As String, IngUser As Long, strUn As String
strBuf = Space$(255)
IngUser = WNetGetUSer("", strBuf, 255)
If IngUser = NO_ERROR Then
strUn = Left(strBuf, InStr(strBuf, vbNullChar) - 1)
WinUsename = strUn
Else
WinUsername = "error:" & IngUser
End If
End Function

Sub CheckUserRights()
Dim UserName As String
UserName = WinUsername
Select Case UserName
Case "Adminstrator"
MsgBox "Full Rights"
Case "Guest"
MsgBox "You Cannot Make Changes"
Case Else
MsgBox "Limited Rights:"
End Select
End Sub
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
  1. Record new Macro
  2. Click Image
  3. Stop Recording Macro
  4. Study and edit new Macro as needed
 
Upvote 0
Paste GIF to worksheet
Right Click
Choose Assign Macro
Assign the desired macro.

You posted two macros and one user defined Function. Not sure what you wanted to use for your GIF object.
 
Upvote 0
Paste GIF to worksheet
Right Click
Choose Assign Macro
Assign the desired macro.

You posted two macros and one user defined Function. Not sure what you wanted to use for your GIF object.

'Want to copy From Sheet 1 from another workbook and paste data into this workbook Flows
'Allow a command button to allow the user to open the workbook how do I do this with a gif? Can you help me with this code?

Sub TrdFlw()
Dim sht As Worksheet
On Error Resume Next
Application.CommandBars("Choose Sheet to Copy").Delete
On Error GoTo 0

'Added this to allow the user to search for the file.
Application.FindFile

With Application.CommandBars.Add("Choose Sheet to Copy", , False, True)
With .Controls.Add(msoControlDropdown)
For Each sht In ActiveWorkbook.Sheets
If sht.Visible = xlSheetVisible Then
.AddItem "" & sht.Name
End If
Next sht
.TooltipText = "SheetNavigate"
.OnAction = "Sheet_Navigate"
End With

.Protection = msoBarNoCustomize
.Position = msoBarFloating
.Visible = True
End With
End Sub

'This is to import data from sheet 1.

Sub Sheet_Navigate()
Dim stActiveSheet As String

With CommandBars.ActionControl
stActiveSheet = .List(.ListIndex)
End With
Worksheets("" & stActiveSheet).Activate

'Added this to copy the selected sheet to the template.
ActiveSheet.Copy Before:=Workbooks("NCUA 5300 Call Report.XLS").Sheets(4)
Application.CommandBars("Choose Sheet to Copy").Visible = False
Sheets("MACRO PAGE").Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,058
Messages
6,128,539
Members
449,457
Latest member
ncguzzo

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