Windows Vista Changing VISTA Registry entries using VB6

  • Thread starter Thread starter ExcelUser
  • Start date Start date
E

ExcelUser

Guest
I am trying to change a Registry entry in HKCU to provide a PDF Printer with
its save file name developed from parameters in Microsoft Access 2003.

If I use REG.EXE in a command prompt window ant type in the required changes
using ADD it works fine and changes the required value.

Attempting the same using Shell in VB6 in an Event Procedure on a Command
Button fails to work

The Code below works fine in creating the PDF Document with the Access
Report Name but I need to change the Save file to give it a client code plus
a Quote Number to prevent overwriting each file.

Code for Command Button Below
======================
Dim MyRpt, MyReport, Myfile, MyFile0, MyParam
Myfile = "Quotation_No_" & Me![Order No] & "_for_" & Forms![Order
Descriptions].Form![Client]
MyParam = " ADD " & Chr(34) &
"HKCU\Software\Softland\novaPDF\Printers\novaPDF Pro v5\Profiles\Default
Profile" & Chr(34) & " /v " & Chr(34) & "Save File" & Chr(34) & " /d " &
Chr(34) & Myfile & Chr(34)
MsgBox "REG" & MyParam
MyFile0 = Shell("REG" & MyParam, 0)
MsgBox "Shell " & MyFile0
MyReport = "Customers Quote Report PDF"
MyRpt = MsgBox("Do you wish to print " & MyReport & "?" & vbLf & vbLf &
"[Yes] = Print " & MyReport & " now" & vbLf & "[No] = Cancel the print
request", 292, "Report Printing Options")
If MyRpt = 6 Then
DoCmd.OpenReport MyReport
Else
DoCmd.OpenReport MyReport, acViewPreview
End If

When I look at

"REG" & MyParam

it appears exactly the same as the Command Prompt statement.

Any Ideas would be bery welcome

Many thanks
 
Re: Changing VISTA Registry entries using VB6

Shelling to an outside EXE to set Registry values?!

If you don't know about the Registry API
then see here for a VB6 class that makes it easy:

http://www.vbaccelerator.com/codelib/inireg/registry.htm


> I am trying to change a Registry entry in HKCU to provide a PDF Printer

with
> its save file name developed from parameters in Microsoft Access 2003.
>
> If I use REG.EXE in a command prompt window ant type in the required

changes
> using ADD it works fine and changes the required value.
>
> Attempting the same using Shell in VB6 in an Event Procedure on a Command
> Button fails to work
>
> The Code below works fine in creating the PDF Document with the Access
> Report Name but I need to change the Save file to give it a client code

plus
> a Quote Number to prevent overwriting each file.
>
> Code for Command Button Below
> ======================
> Dim MyRpt, MyReport, Myfile, MyFile0, MyParam
> Myfile = "Quotation_No_" & Me![Order No] & "_for_" & Forms![Order
> Descriptions].Form![Client]
> MyParam = " ADD " & Chr(34) &
> "HKCU\Software\Softland\novaPDF\Printers\novaPDF Pro v5\Profiles\Default
> Profile" & Chr(34) & " /v " & Chr(34) & "Save File" & Chr(34) & " /d " &
> Chr(34) & Myfile & Chr(34)
> MsgBox "REG" & MyParam
> MyFile0 = Shell("REG" & MyParam, 0)
> MsgBox "Shell " & MyFile0
> MyReport = "Customers Quote Report PDF"
> MyRpt = MsgBox("Do you wish to print " & MyReport & "?" & vbLf & vbLf

&
> "[Yes] = Print " & MyReport & " now" & vbLf & "[No] = Cancel the print
> request", 292, "Report Printing Options")
> If MyRpt = 6 Then
> DoCmd.OpenReport MyReport
> Else
> DoCmd.OpenReport MyReport, acViewPreview
> End If
>
> When I look at
>
> "REG" & MyParam
>
> it appears exactly the same as the Command Prompt statement.
>
> Any Ideas would be bery welcome
>
> Many thanks
>
>
 
Back
Top