Convert image to Base64 string in VBA

Hi.

Im mapping some XML fields in a worksheet to be exported to a web page.
On of this fields is a image field and it only accepts images in a base64 
string format.

how can o convert a "normal" image to a base64 string inside excel trough VBA?

thanks a Lot!!!

Speed
0
Utf
1/11/2010 12:40:01 PM
excel.programming 6508 articles. 2 followers. Follow

3 Replies
7011 Views

Similar Articles

[PageSpeed] 18

What file type is the source and the converted.  Are you trying to
convert BIT mapped files to JPG or something similar.  You can't convert
an image to 64  bit format by just changing the string you need a
utility.

Excel VBA can't convert directly but can call other utilites that you
have installed on your PC.  Excel can convert a worksheet to either JPG
or Bit mapped by savving as a picture but I don't think this is what you
want.


-- 
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=168783

[url="http://www.thecodecage.com"]Microsoft Office Help[/url]

0
joel
1/11/2010 2:37:35 PM
Hi joel.

For what i discovered today there some components that will do the trick.
Anyway, if anyone has some direct answer (code) to this please post it here!

SpeeD

P.S: it´s important that i only use common components (do not install 
anything) because i have to distribute the Workbook...

"joel" wrote:

> 
> What file type is the source and the converted.  Are you trying to
> convert BIT mapped files to JPG or something similar.  You can't convert
> an image to 64  bit format by just changing the string you need a
> utility.
> 
> Excel VBA can't convert directly but can call other utilites that you
> have installed on your PC.  Excel can convert a worksheet to either JPG
> or Bit mapped by savving as a picture but I don't think this is what you
> want.
> 
> 
> -- 
> joel
> ------------------------------------------------------------------------
> joel's Profile: 229
> View this thread: http://www.thecodecage.com/forumz/showthread.php?t=168783
> 
> [url="http://www.thecodecage.com"]Microsoft Office Help[/url]
> 
> .
> 
0
Utf
1/11/2010 9:19:01 PM
Where are the images you need to convert located?

Base64 encoding in VB/VBA:
http://www.nonhostile.com/howto-encode-decode-base64-vb6.asp
http://www.motobit.com/tips/detpg_Base64Encode/

Tim


"SpeeD" <SpeeD@discussions.microsoft.com> wrote in message 
news:D9B51C6F-99B6-435E-81CD-8F476D69D7E9@microsoft.com...
> Hi joel.
>
> For what i discovered today there some components that will do the trick.
> Anyway, if anyone has some direct answer (code) to this please post it 
> here!
>
> SpeeD
>
> P.S: it�s important that i only use common components (do not install
> anything) because i have to distribute the Workbook...
>
> "joel" wrote:
>
>>
>> What file type is the source and the converted.  Are you trying to
>> convert BIT mapped files to JPG or something similar.  You can't convert
>> an image to 64  bit format by just changing the string you need a
>> utility.
>>
>> Excel VBA can't convert directly but can call other utilites that you
>> have installed on your PC.  Excel can convert a worksheet to either JPG
>> or Bit mapped by savving as a picture but I don't think this is what you
>> want.
>>
>>
>> -- 
>> joel
>> ------------------------------------------------------------------------
>> joel's Profile: 229
>> View this thread: 
>> http://www.thecodecage.com/forumz/showthread.php?t=168783
>>
>> [url="http://www.thecodecage.com"]Microsoft Office Help[/url]
>>
>> .
>> 


0
Tim
1/12/2010 6:51:34 AM
Reply:

Similar Artilces:

How do I convert an existing MS Excel worksheet tracking a simple. #2
I am a novie Excel user who has tracked the activity of my simple savings account with an Excel worksheet. I would like to set up this existing worksheet to perform autosum functions when I enter deposits, withdrawals, and interest instead of manually doing the math on a calculator to arrive at the balance total after each entry. ...

Re: Converting Access Database From 2003 to Access 97
jixiaoli <jiaxialoli@eyou.com> wrote in message news:... > > Tim <xtimx_wildingx@yah.com> wrote in message > news:27e001c3fc97$6b59bbd0$a501280a@phx.gbl... > I am developing applications in VB and Access. I distribute an Access 97 > database as part of the system. I have recently upgraded from using Access > XP to Access 2003 to manage the distributed database. Since I still wish to > distribute the database in Access 97 format to clients, I convert the file > from Access 2003 to Access 97 format before distribution. The distribution > database contains ...

How do I make an image more or less transparent in Microsoft Publi
Please Help?! Select your image, color icon, select washout. For objects you fill yourself, such as autoshapes, you can set the transparency. Click fill, fill effects. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Plattner Orthopedic" <Plattner Orthopedic@discussions.microsoft.com> wrote in message news:8ACFF04D-B97A-437E-B294-F60378CFDB62@microsoft.com... > Please Help?! Which version of Publisher are you using. Sorry we do not know as our crystal balls failed from overwork "Plattner Orthopedic"...

Webmethod returned String to XML
Hi I have a webmethod which returns the contets of an xml file as a string. Now I want to convert this string back to an XML Document ideally an XPathDocument. How do i do that??? ...

Damsel in distress needs VBA help!!!
Hi, I have 45 customer service reps weekly schedules in an excel spreadsheet. They all are on one of 4 teams and are listed alphabetically as so: Doe,John start time break 1 lunch break 2 Monday 8:00 10:15 1:30 3:15 Tuesday Weds etc.. I need them to be sorted by team. I think a macro for each team would be the easiest way to do this. I need code that would go through the alphabetical list and search for an agents name and delte that row and the 10 rows below it. I have no idea where to begin or even how to be able to set...

in VBA
Using Office 2003 I would like to reset any custom filter settings from all columns. The following resets Column 1 only: Selection.AutoFilter Field:=1 What is the VBA code to reset Columns 1-17? TIA Dennis Dennis, Selection.AutoFilter You could have found that out by yourself if you had just used Macro Record (as I did). -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Dennis" <dmburgess@removespamameritech.net> wrote in message news:961i10teu4q5r2t6rh38bmen6lski9r6f6@...

Problem when converting handwriting to text
Hi, I have a tablet, Motion Computing LE1700, with Windows 7 Professional 32 bits English. I installed Office 2007 and OneNote 2007 in Spanish. I take notes sometimes in English, sometimes in Spanish. I thought that OneNote could convert handwriting to text in English and Spanish but it is only working in English. When I try to convert handwriting in Spanish (choosing Spanish as main language) OneNote does nothing. No error, no messages, absolutely nothing. The same behavior happens with OneNote 2010 Beta Spanish. Is it correct? How could I convert Spanish handwriting to te...

Attached Image file
Hi, Previously a user of outlook express, after upgraded to Outlook 2003. Find that the image viewing from outlook attachement very suffering... not like outlook express, i can scroll through all attached image inside my e-mail, but for outlook, i have double-click all the attached image in order to view them... is there a way to make image viewing easier.. pls advice what setting i can set in outlook 2003 or my exhange server 2003 ?? Thanks! No such setting. Outlook does not preview attachments inline intentionally. This is not Outlook Express. -- Russ Vale...

Excel VBA
I can't seem to find the 'Draw" menu in Excel VBA... Am I correct in assuming that there is none? And that the Frame is the only way to group stuff on a Form?? thanks The frame is typical, but you can group some controls by using the GroupName. If you want lines on the userform, I think lots of people use a label that's really skinny--or use a picture of a line and then use that picture. tmb wrote: > > I can't seem to find the 'Draw" menu in Excel VBA... > > Am I correct in assuming that there is none? > > And that the Frame is the onl...

How do I convert a csv file to an Excel file?
Hi- My Excel program does not recognize .csv files. I know Excel can easily convert these files, but I am not sure how to tell my version of Excel to do this. It is Excel 2002 on Windows XP. Any suggestions? Thanks- Anne In Excel File -> Open Change "Files of Type" to ALL Files You should be able to see your CSV file. "Anne B" wrote: > Hi- > > My Excel program does not recognize .csv files. I know Excel can easily > convert these files, but I am not sure how to tell my version of Excel to do > this. It is Excel 2002 on Windows XP. Any su...

Converting PostedFile to an XMLDocument.
I need to convert an HTTPPostedFile I am getting from the client to an XMLDocument. The class I am using must have a document. The following gives me an error when I try and build. I cannot change the converting class. Any help would be appreciated. The error is: Value of type 'System.Web.HttpPostedFile' cannot be converted to 'System.Xml.XmlDocument' The code: Select Case Extension Case "xml" ConvertXML.LoadCMRToTempTables(Session.SessionID, SelectedFile.PostedFile) <<< error here. Case ".B8" ConvertB8.LoadB8IntoTe...

convert an angle to degrees minutes seconds
angles are formatted like 90.5 degrees. or 90 degrees 30 mins 00 seconds it shoult look like this 90* 30' 00" (the * is a degree symbol) i odnt know how to get excell to do this See http://cpearson.com/excel/latlong.htm In article <3350A92A-E3AF-4977-B034-CFE6BC454AFF@microsoft.com>, Mac <Mac@discussions.microsoft.com> wrote: > angles are formatted like 90.5 degrees. or 90 degrees 30 mins 00 seconds it > shoult look like this 90* 30' 00" (the * is a degree symbol) i odnt know how > to get excell to do this ...

How to convert an Excel file to CSV File
IS there anyway to convert an excel file into comma delimited file - I used the Save as and CSV file format, but that didnt help much. Any other options/ways we can do this. Thanks, Damu "Damu"... > IS there anyway to convert an excel file into comma delimited file - I > used the Save as and CSV file format, but that didnt help much. hi Damu, Worksforme, what did it do instead for you. If you view it in Excel it is going to look like nothing changed. View the created .csv file with Notepad such as right click on the file from Explorer (File Manager) and View with No...

Publisher 2007's PDF converter removes transparency from pictures.
Hello, I really would appreciate any help in the following issue. I have some gif pictures in my publisher 2007 document that are transparent (tried this with png pictures too). Everything looks good when I print the document to a printer. But if I use Microsoft's built-in PDF converter then the transparancy becomes "white" and that is not good. My printer requires a PDF and can't work from publisher 2007 files. Any suggestions on how to STOP publisher from getting rid of the transparency?? Thanks! I'm not seeing this. When you move the image over another obje...

User Defined Field (String)
Does anyone know of a way I can force a user-defined field (I'm working specifically with User Defined 1 in Sales Trx Entry - a String(20) field) to force formatting at data entry time to US dollar (eg. $100.00) formatting? Either with VBA or Modifier? I would need to do this a couple of individual User Defined fields in the SOP User Defined fields entry window. Thanks in advance. Not a good way to do this - you could maybe use a vba event to format the data after the user enters it but vba isn't real happy typically of setting the current field when running its ...

Excel VBA
I have a workbook that has multiple worksheets and 2 of them are letters. I would like to autofill data into the letters by using the userform. I have been able to code it using 1 worksheet. Is it possible to use same userform for the different worksheets? Thank you! Very simple, but you need to be more specific if you want some aid. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "djshides" <djshides@discussions.microsoft.com> wrote in message news:51B36917-FC0E-4567-B7D7-4B37E8A365B1@microsoft.com... > I have a workbook t...

VBA moving and adding data
I have this appliaction that spits out a format that is not usable for me, but with some minor changes it would be good to go. I just don't know how the code would work. here is what part of my file looks like: ColumnA Coulmn B Column C Column D FAULT F02 8 PILLAR 3018169.273 492458.0997 -9771.365343 3017502.798 493106.6833 -8696.365343 3016836.323 493755.2668 -7621.365343 3016169.848 494403.8503 -6546.365343 3015503.373 495052.4339 -5471.365343 Here is what I would like it to look like: ColumnA ...

VBA calling sp with ANSI_NULLS set ON
Hi, On Query Analyzer, I created a sp as follow: > > if exists (select * from dbo.sysobjects where id = object_id(N'dbo.PCS_SEG1') and OBJECTPROPERTY(id, N'IsProcedure')= 1) DROP PROCEDURE dbo.PCS_SEG1 GO CREATE PROCEDURE dbo.PCS_SEG1 as set ANSI_NULLS on set ANSI_WARNINGS on ** sql statement *** > > I need the to set ANSI_NULLS and ANSI_WARNINGS on as it involves another server using linked server. When executing the sp from query analyzer, it works fine too: > exec PCS_SEG1 > But, when I called from VBA, I received error: Heterogeneous queries require t...

Using A Macro/VBA code to re-set formulas
Hi can any one help me with a Macro/VBA code to re-set formulas in pre-defined set of cells i.e. in my case C14:C40 At present I have a copy of the Formulas in another part of th worksheet and when I want to reset the worksheet (as the user can ove right the formulas as the formula is based on either the sum of anothe two cells or the users input) I use a Macro to copy and paste (special the formulas. What I require is a Macro/VBA Code which already has the formula store in the actual Macro/VBA code i.e. so they are not stored as copy in m worksheet Ay help would be greatly appreciated T...

Excel VBA
Hi Excel VBA advisers! I have a userform where there are two text boxes (drugdesc1 & drugdesc2) that I want to force 4 commas to be keyed into both fields. 4 commas are MANDATORY in each text box & are used to separate the type of input within each. ie; brand name, ingredients, strength, form, pack size. (FYI: Later on, I split these fields into 4 separate columns based on the comma delimiter.) When "cmdAdd" command button is clicked, I need to display a msgbox to advise user and disallow the add. I imagine that the code (repeated for each text box) that I would put in th...

Converting a PDF of an Excel sheet back to Excel?
Hi Everyone, I have just been asked by my boss if it is possible to convert a PDF of an excel worksheet back into excel!I have no idea if it is possible, can anyone please help in this regard? Cheers Ash You should be able to copy and paste the values, but you definitely will lose the formulas. On Thu, 23 Sep 2004 17:31:48 -0700, "Ashley" <anonymous@discussions.microsoft.com> wrote: >Hi Everyone, > >I have just been asked by my boss if it is possible to >convert a PDF of an excel worksheet back into excel!I have >no idea if it is possible, can anyone pl...

VBA Function to explode string
Hi. I am wanting to know hbow I would go about getting the following 3 cells: Cells A1, A2, A3: :: 1-4,6,8 50 S1B1:: Into a form that looks more like this ::A1 A2 A3 1 8.33 S1B1 2 8.33 S1B1 3 8.33 S1B1 4 8.33 S1B1 6 8.33 S1B1 8 8.35 S1B1:: How it does the rounding (and on which one), it does not matter! Thanks, Tom -- tomjermy ------------------------------------------------------------------------ tomjermy's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=24666 View this thread: http://www.excelforum.com/showthread.php?threadid=382414 You haven't exp...

Converting time to decimal then rounding
Hi I have a formula =MOD(T11-R11,1)*24 Where T11 is 22:43 and R11 is 22:34 The difference of these time values is 9 minutes or .15. Currently I am getting the result of .1 because it is not rounding up. The result I need is ..2 -- so that Excel will round .01 to .04 down and .05 to .09 up. How should I adjust my formula? Thanks!! Maybe: ROUNDUP((A1-A2)*24,1) Micky "JB Bates" wrote: > Hi > > I have a formula > > =MOD(T11-R11,1)*24 > > Where T11 is 22:43 and R11 is 22:34 > > The difference of these time values i...

C-DLL-VBA-EXCEL strings
Hello, I'm trying to connect excel to a C dll library (call C dll from excel through the VBA). It works well for returning integer and double values (see simple example below), but I can't seem to get it to return strings. I am using MinGW gcc (so basically only C) to construct my dll, so I don't have access to BSTR and other cpp like objects/functions... Is there a way to make the C dll return strings to excel? Thanks DLL.c #ifdef BUILD_DLL #define EXPORT __declspec(dllexport) #else #define EXPORT __declspec(dllimport) #endif EXPORT int __stdcall add2(int num){ return num + 2; ...

How to select combobx value with vba?
For an electrical part number quoting application developed in Excel 2000, I have a a userform (userform4) with a combobox (cboQpn) to hold the quoted part number, and another combobox (cboFormula) prepopulated with a named range (Partnum) The user types in a part number in cboQpn and then chooses the correct formula from cboFormula. Now in access I have a table (tblDetail) that holds previously quoted part numbers and their details--the formula used in the previous quote, for example. The formula information is in column 5 in tblDetail I want to emulate the manual selecting o...