473,383 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Programtically create mdw file

Having nothing better to do today, I decided to do something that apparently
only Michael Kaplan knows how to do (and cannot disclose due to legal
reasons).
My method is really nothing more than a stupid cheat, embedding the whole
binary contents of the file in vba code, but who needs more? It seems to
create the file quickly and reliably and avoids using an OLE field in a
table to do this (which some people don't like). Apart from the slightly
large module size, I can't see any reason to avoid this method. Does anyone
care to comment?
Public Function CreateWorkgroup(strPath As String) As Boolean

On Error GoTo Err_Handler

Dim a(0 To 3327) As String
Dim lngCount As Long
Dim strData As String
Dim intFile As Integer

a(0) =
"000100004A65742053797374656D20444220200001000000B 56E03626009C255"
a(1) =
"E9A96772403F009C7E9F90FF859A31C57FBAED30BBDFCC9D6 3D9E4C39F46AE38"
a(2) =
"4BEE7A6DEC37A1D29CFA3AC828E6EF208A60A8027B3609E4D FB18B6213433339"

<snip><snip><snip><snip><snip><snip>

a(3327) =
"6A2EED6AD8861A1B71052B9CFACCE699FC170E04EC32CD1D8 55E70B4CF6E38D7"

For lngCount = 0 To 3327
strData = strData & ConvertHex(a(lngCount))
Next lngCount

intFile = FreeFile

Open strPath For Binary As intFile

Put intFile, , strData

Close intFile

CreateWorkgroup = True

Exit_Handler:
Exit Function

Err_Handler:
MsgBox Err.Description, vbExclamation, "Error No: " & Err.Number
Resume Exit_Handler

End Function

Private Function ConvertHex(strCode As String) As String

Dim lngPos As Long
Dim strData As String
Dim str As String

If Len(strCode) > 1 Then
If Len(strCode) Mod 2 = 0 Then
lngPos = 1
Do While lngPos < Len(strCode)
strData = strData & Chr$(CLng("&H" & Mid$(strCode, lngPos,
2)))
lngPos = lngPos + 2
Loop
End If
End If

ConvertHex = strData

End Function
Nov 13 '05 #1
2 3047
On Thu, 27 Oct 2005 11:03:11 +0000 (UTC), "Brian Wilson"
<bw*****@ease.co.uk> wrote:

Not sure what problem you're trying to solve. I would simply ship the
MDW file with my application.
-Tom.

Having nothing better to do today, I decided to do something that apparently
only Michael Kaplan knows how to do (and cannot disclose due to legal
reasons).
My method is really nothing more than a stupid cheat, embedding the whole
binary contents of the file in vba code, but who needs more? It seems to
create the file quickly and reliably and avoids using an OLE field in a
table to do this (which some people don't like). Apart from the slightly
large module size, I can't see any reason to avoid this method. Does anyone
care to comment?
Public Function CreateWorkgroup(strPath As String) As Boolean

On Error GoTo Err_Handler

Dim a(0 To 3327) As String
Dim lngCount As Long
Dim strData As String
Dim intFile As Integer

a(0) =
"000100004A65742053797374656D20444220200001000000 B56E03626009C255"
a(1) =
"E9A96772403F009C7E9F90FF859A31C57FBAED30BBDFCC9D 63D9E4C39F46AE38"
a(2) =
"4BEE7A6DEC37A1D29CFA3AC828E6EF208A60A8027B3609E4 DFB18B6213433339"

<snip><snip><snip><snip><snip><snip>

a(3327) =
"6A2EED6AD8861A1B71052B9CFACCE699FC170E04EC32CD1D 855E70B4CF6E38D7"

For lngCount = 0 To 3327
strData = strData & ConvertHex(a(lngCount))
Next lngCount

intFile = FreeFile

Open strPath For Binary As intFile

Put intFile, , strData

Close intFile

CreateWorkgroup = True

Exit_Handler:
Exit Function

Err_Handler:
MsgBox Err.Description, vbExclamation, "Error No: " & Err.Number
Resume Exit_Handler

End Function

Private Function ConvertHex(strCode As String) As String

Dim lngPos As Long
Dim strData As String
Dim str As String

If Len(strCode) > 1 Then
If Len(strCode) Mod 2 = 0 Then
lngPos = 1
Do While lngPos < Len(strCode)
strData = strData & Chr$(CLng("&H" & Mid$(strCode, lngPos,
2)))
lngPos = lngPos + 2
Loop
End If
End If

ConvertHex = strData

End Function


Nov 13 '05 #2
"Tom van Stiphout" <no*************@cox.net> wrote in message
news:35********************************@4ax.com...
On Thu, 27 Oct 2005 11:03:11 +0000 (UTC), "Brian Wilson"
<bw*****@ease.co.uk> wrote:

Not sure what problem you're trying to solve. I would simply ship the
MDW file with my application.
-Tom.


Just passing the time of day as I'm "between contracts" (I think that is the
term they use). Anyway I was searching the archives and found other people
asking the same question - and it crossed my mind that if someone did
actually need to create a workgroup file programatically, then it could be
done using only vba code although other people have stated it is not
possible.
I realise that the technique is not rocket science, but it is a general
method which might prove useful to someone who wanted to make any small
binary automagically appear. So provided the user had not deleted the
mdb/mde itself, then it could restore from scratch a number of small
binaries such as icons, images or perhaps Word templates. However, as you
see, I have not been bombarded with responses, so perhaps no-one else can
see a use for the technique.
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
3
by: Luis Esteban Valencia | last post by:
Is there a way to make this kind of graphics with asp.net? http://www.avansoft.net/~levalencia/Dibujo.GIF
4
by: I_AM_DON_AND_YOU? | last post by:
There is one more problem I am facing but didn't get the solution. In my Setup Program I am not been able to create 2 things (when the program is intalled on the client machine ) : (1) create...
5
by: Michael Sperlle | last post by:
Is it possible? Bestcrypt can supposedly be set up on linux, but it seems to need changes to the kernel before it can be installed, and I have no intention of going through whatever hell that would...
8
by: barb | last post by:
So that the world at large benefits from our efforts, here is one fully documented way to use Windows Irfanview freeware to create thumbnail web galleries (http://www.irfanview.com). STEP 1:...
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
3
by: rembi | last post by:
I am running a service (sourceforge.net/projects/statfink/ ) that pulls and displays fantasy football statistics. One of the limitations is that it only pulls stats for games that are active or...
3
by: sanghavi | last post by:
how to create a set up project in vb.net..how to run an application on a different machine
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.