Sagittariu5
New Member
- Joined
- Oct 30, 2013
- Messages
- 5
Hello All
Being new to the forum as well as self taught in VBA was hoping for some insight
I'm trying to find a way to enable me to just VIEW object(s) inserted (below Code) in a Projected sheet, WITHOUT tamparing (deleting, changing) or editing the object.
Hoping someone could point me in the right direction.
Kind Regards
Sagittariu5</SPAN></SPAN>
Being new to the forum as well as self taught in VBA was hoping for some insight
I'm trying to find a way to enable me to just VIEW object(s) inserted (below Code) in a Projected sheet, WITHOUT tamparing (deleting, changing) or editing the object.
Code:
Private Sub Insert_OLE_Object()
ActiveWorkbook.Unprotect Password:=""
Sheets("BackUp").Unprotect Password:=""
FinalRow = Cells(Rows.Count, "C").End(xlUp).Row
Range("C" & FinalRow).Select
'
Dim iconToUse As String
Dim fullFileName As String
Dim FNExtension As String
' Ask which file to Insert
x = Application.GetOpenFilename( _
FileFilter:="All Files (*.*), *.*", _
Title:="Choose File to Insert", MultiSelect:=False)#
'Choose an icon based on filename extension get all after last "." in filename
FNExtension = Right(x, Len(x) - InStrRev(x, "."))
'Select icon based on filename extension
Select Case UCase(FNExtension)
Case Is = "TXT"
iconToUse = "C:\WINDOWS\system32\Packager.exe"
Case Is = "XLS", "XLSM", "XLSX"
iconToUse = "C:\WINDOWS\Installer\{90120000-0012-0000-0000-0000000FF1CE}\xlicons.exe"
Case Is = "DOC", "DOCM", "DOCX"
iconToUse = "C:\WINDOWS\Installer\{90120000-0012-0000-0000-0000000FF1CE}\wordicon.exe"
Case Is = "PDF"
iconToUse = "C:\WINDOWS\Installer\{AC76BA86-7AD7-1033-7B44-A81000000003}\PDFFile_8.ico"
Case Else
'This is a generic icon
iconToUse = "C:\Windows\system32\packager.dll"
End Select
Worksheets("BackUp").OLEObjects.Add(fileName:=x, Link:=False, _
DisplayAsIcon:=True, IconFileName:=iconToUse, IconIndex:=0, IconLabel:=GetFileNameWithoutExt(x)).Activate
ActiveCell.Offset(1, 0).Select
' Check in case no files were selected
If x = "False" Then Exit Sub
ActiveWorkbook.Protect Password:=""
ActiveWorkbook.Protect Password:=""
Sheets("Main Reconciliation").Select
End Sub
Hoping someone could point me in the right direction.
Kind Regards
Sagittariu5</SPAN></SPAN>