N
Nate H.
I've been trying to setup a document where the user enters two values (Height
and Width). They also choose a screen resolution from a drop-down form.
From these values, I'm trying to send a 'calculated' pixel size back in to
document. Here's my code. The Height and Width values aren't being assigned
correctly for some reason.
Sub calculateResolution()
Dim dbArea As Double
Dim dbHeight As Double
Dim dbWidth As Double
Dim dbPixelSize As Double
Dim dbPixels As Double
dbHeight = ActiveDocument.FormFields("FOVHeight")
dbWidth = ActiveDocument.FormFields("FOVWidth")
dbArea = dbHeight * dbWidth
dbPixelSize = dbPixels / dbArea
Select Case Selection.FormFields("Resolution").Result
Case "640x480"
dbPixelSize = Width / 640
ActiveDocument.FormFields("PixelSize").Result = dbPixelSize
Case "1024x768"
dbPixelSize = 1024 dbWidth / 1024
ActiveDocument.FormFields("PixelSize").Result = dbPixelSize
Case "1600x1200"
dbPixelSize = dbWidth / 1600
ActiveDocument.FormFields("PixelSize").Result = dbPixelSize
End Select
End Sub
and Width). They also choose a screen resolution from a drop-down form.
From these values, I'm trying to send a 'calculated' pixel size back in to
document. Here's my code. The Height and Width values aren't being assigned
correctly for some reason.
Sub calculateResolution()
Dim dbArea As Double
Dim dbHeight As Double
Dim dbWidth As Double
Dim dbPixelSize As Double
Dim dbPixels As Double
dbHeight = ActiveDocument.FormFields("FOVHeight")
dbWidth = ActiveDocument.FormFields("FOVWidth")
dbArea = dbHeight * dbWidth
dbPixelSize = dbPixels / dbArea
Select Case Selection.FormFields("Resolution").Result
Case "640x480"
dbPixelSize = Width / 640
ActiveDocument.FormFields("PixelSize").Result = dbPixelSize
Case "1024x768"
dbPixelSize = 1024 dbWidth / 1024
ActiveDocument.FormFields("PixelSize").Result = dbPixelSize
Case "1600x1200"
dbPixelSize = dbWidth / 1600
ActiveDocument.FormFields("PixelSize").Result = dbPixelSize
End Select
End Sub