Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
unidentified user
meward
Posts: 7
Registered: 06-28-2011
0
Accepted Solution

VB Script - Need help to complete this VB Sript in Customizer

When clicing a custom button, I would like the lot number to become part of the file path location so that Adobe will launch and will pull up a file - the lot number is part of the file name.

 

This is what I have so far (see below) - I am doing this script button at the LotSerialNumber Inquiry page

 

' Use ShellExecute to open a particular file
Set objShell = CreateObject("Shell.Application")

objShell.ShellExecute( "M:\Quality Logs\Quality Logs\Master-CofA File\" & (ML_LOTSERIALNO$) &".pdf")

 

I would like for the actual lot number value to pass through and be part of the file path - right where I have noted  (ML_LOTSERIALNO$)

Switcher
BigLouie
Posts: 2,689
Registered: 10-28-2008
0

Re: VB Script - Need help to complete this VB Sript in Customizer

I have this posted somewhere around here. Not in this section but in another. It is at the office so I'll post in the morning if no one has replied.

Big Louie No MBA but BMOC
--------------------------------------------------------------------------
You have enemies? Good. That means you've stood up for something in your life.
unidentified user
meward
Posts: 7
Registered: 06-28-2011
0

Re: VB Script - Need help to complete this VB Sript in Customizer

Thanks Louie! I know that I am close with what I have now... But still No Cigar!

I will check back in the morning.

 

valTyp = ""

retVal = oBusObj.GetValue("ML_LOTSERIALNO$", lotno)

 

' Use ShellExecute to open a particular file

Set objShell = CreateObject("Shell.Application")

 

objShell.ShellExecute( "M:\Quality Logs\Quality Logs\Master-CofA File\" & lotno &".pdf")

 

Switcher
BigLouie
Posts: 2,689
Registered: 10-28-2008
0

Re: VB Script - Need help to complete this VB Sript in Customizer

Here is what I use to call up a file.

 

Dim wsh
set wsh = CreateObject("WScript.Shell") 
Set filesys = CreateObject("Scripting.FileSystemObject")
PDFPath = "L:\Products\DrawingsPDF\" 
PDFFile = ML_UDF_IMH_DRAWING_LOCATION
docPath = "L:\DrawingsPDF\" 


if filesys.FileExists(PDFPath & PDFFile) then 
  Return = wsh.Run(chr( 34) & PDFPath&PDFFile & chr(34),1,False)
else 
  Return = wsh.Run(chr( 34) & docPath&PDFFile & chr(34),1,False) 
end if 

Set wsh = Nothing

 In your case you can substitude what I have for PFDFile with ML_LOTSERIALNO$

Big Louie No MBA but BMOC
--------------------------------------------------------------------------
You have enemies? Good. That means you've stood up for something in your life.
unidentified user
meward
Posts: 7
Registered: 06-28-2011
0

Re: VB Script - Need help to complete this VB Sript in Customizer

Hi Louie - Please see the attached file - this is the error I get when trying what you have suggested below. Did I miss something?

 

I have also tried this: 

objShell.ShellExecute("M:\Quality Logs\Quality Logs\Master-CofA File\" & ML_LOTSERIALNO$ & ".pdf")

And I get a similar error (below)

 

Script Line........  27

Script Column......  87

Script Text........  objShell.ShellExecute("M:

Quality Logs

Quality Logs

Master-CofA File

" & ML_LOTSERIALNO$ & ".pdf")

 

Any ideas of what to try next? :smileysad:

unidentified user
meward
Posts: 7
Registered: 06-28-2011
0

Re: VB Script - Need help to complete this VB Sript in Customizer

This code works to pull the CofA (.pdf file) -

 

' Use ShellExecute to open a particular file
Set objShell = CreateObject("Shell.Application")

objShell.ShellExecute( "M:\Quality Logs\Quality Logs\Master-CofA File\JBPH87.pdf" )

 

Now if I can get the lot number portion of this code to feed in from the field ML_LOTSERIALNO$ after it returns that value to the script, that is exactly what I need it to do. Dunno why the error :smileysad:

unidentified user
meward
Posts: 7
Registered: 06-28-2011
0

Re: VB Script - Need help to complete this VB Sript in Customizer

I GOT IT!!!!!!!!!! Had to remove the $ from the FIELDNAME

ML_LOTSERIALNO$

 

I used ML_LOTSERIALNO