Accessing an image that's inside of an Excel Table via VBA
I am designing a VBA Form in Excel. The Workbook has a table called "images", and inside there I am dropping some images from my local hard drive.
These Workbook & UserForm are to be shared with my colleagues. They might not have these images in their harddrive, but they will have them inside of the Excel table.
I am looking for a way to load an image that's inside of a table inside of an "Image" VBA form control.
In Google all I find is how to load an image from my hard drive (i.e. using an absolute path like "C:/my_images/car.png"). What I can't find is how to load an image that's within a table, i.e. already bundled within the Workbook.
See also questions close to this topic
I need to CONCATENATE a letter while dividing selected cells by a constant
I have blocks of data where some of he data in the block has a multiple of 10 applied. I need to remove the multiple of 10 and add an "A" to the same cells. There is two sets of ranges where the data lies between.
Code that was recorded
Sub FixShaded() ' ' FixShaded Macro Range("H2766").Select ActiveCell.FormulaR1C1 = "=""A""&(RC[-6]/10)" Range("H2766").Select Selection.AutoFill Destination:=Range("H2766:H2770"), Type:=xlFillDefault Range("H2766:H2770").Select Selection.Copy Range("B2766").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Range("H2766:H2770").Select Application.CutCopyMode = False Selection.ClearContents End Sub
Code that I am trying to get to work
Sub findRange() Dim WorkRng As Range Dim cell As Range Const CL As Long = 10 Dim sht As Worksheet Set sht = ActiveSheet Dim i As Long Set WorkRng = Application.Intersect(Selection, ActiveSheet.UsedRange) For Each cell In WorkRng If WorkRng > 150 And WorkRng < 1000 Then WorkRng.Value = WorkRng.Value / CL End If If WorkRng > 20000 And WorkRng < 250000 Then WorkRng.Value = WorkRng.Value / CL End If Next End Sub
Sorry I am only 3 months into VBA and trying Thank you
How to make excel workbook open on a certain row without using Workbook_Open
I'm currently writing a macro button that creates a new workbook, writes to it, and emails it to a client. The macro works fine, but when the client opens the workbook, it opens on the first row of the workbook, and the client needs to scroll all the way down to find the data they need. I would like the Excel file to open in the middle row of the file. Is that possible to do in VBA?
Please note that this workbook that is being emailed CANNOT contain any macros due to security reasons. Thus writing code on the
Workbook_Open()method to go to a certain row is not feasible in my case.
Macro not running after moving to an addin
I have a macro in my personal workbook that runs fine. I moved the code into an add-in and now I am getting an error saying
Cannot run the macro... The macro may not be available in this workbook or all macros may be disabled.
Dim book As Workbook Dim sh As Worksheet Set book = ActiveWorkbook Set sh = book.ActiveSheet With sh .Columns("K").Delete .Columns("L").Delete lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
How do I run the VBA msi installer dependencies based on install options using WiX?
I am in the process of creating a new WiX 3.x installer project for our older integration product that depends on the VBA SDK in Visual Studio 2017.
Our product currently uses an extremely outdated InstallShield project that I've determined isn't really salvageable and selected WiX for various reasons. One of the many reasons is that (Unlike the VBA 6.3 Redist) the VBA 7.1 redistributables do not come with any installation wrapper and the SDK only includes some VS2010 project code written in C to generate a setup.exe file.
Originally I was going to convert/re-write the C code to C# and create a custom action. Then as I heard about Burn.exe I thought that may be an option, but it seems that does not have the ability to act dynamically based off installer dialog options from my main install project. (Am I wrong here?)
Ideally, I wish there were merge modules for the VBA 7.1 runtimes. However, since MS stopped offering new SDK licenses years ago (we're grandfathered in) all developer support for the SDK has disappeared from their site. All my searching for a merge module set has been futile.
So for VBA 7.1, I have a main MSI and a dozen or so optional MSI packages depending on environment and localization.
How best should I incorporate these into an installer package for our integration product with the prerequisites mentioned above?
I'm trying to incorporate a formula from another worksheet to be used on the other one but can't make it
Sub new_form() Worksheets("Chicago").Activate Worksheets("Chicago").Range("Q3:Q7").Formula = ("=Q3-1") End Sub
Complete code for Excel VBA with no-replace
i am looking a complete code for excel with below requirement.
- Right click on sheet shall not to work
- cut/copy/paste/insert/menu option shall not to work
- auto file creation require with in the folder
- file path should be accessible by user
- updated file should be create auto version with provided format/sequence
- file shall not be replace, it should create with another file name only.
sorting multiple column
I wanted to sort my data like name(first
columnA) in alphabetical order, then sorting another column
Min descending order without changing the first column. However, I only get the name sort then and there's no change in my number column. Did I go wrong somewhere?
this is my code
Sub sbort369() Range("A1").CurrentRegion.Sort key1:=Range("TOTAL_MACHINE_HOUR_FOR_THE_MONTH"), order1:=xlDescending, Header:=xlYes Range("A1").CurrentRegion.Sort key1:=Range("NAME"), order1:=xlAscending, Header:=xlYes End Sub