ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,596
- Office Version
- 2007
- Platform
- Windows
To make this clear i am working in one workbook BUT i wish to open a Userform in a different workbook.
Basically in my workbook the activecell value needs to be found in the newly opened workbook of which it dose fine.
The code finds the value it was searching for & the cell is selected / active.
My goal is to now open a userform called DiscoII
The problem i am facing is when i use DiscoII.Show nothing happens.
Am i missing something here ?
Any help will put this knightmare to bed.
Thanks
Basically in my workbook the activecell value needs to be found in the newly opened workbook of which it dose fine.
The code finds the value it was searching for & the cell is selected / active.
My goal is to now open a userform called DiscoII
The problem i am facing is when i use DiscoII.Show nothing happens.
Am i missing something here ?
Any help will put this knightmare to bed.
Thanks
VBA Code:
Private Sub PurchasedKey_Click()
Dim sPath As String
Dim strFileName As String
Dim sh As Worksheet
With ActiveSheet
If .Range("Q1") = "" Then
MsgBox "NO CODE SHOWN TO GENERATE PDF", vbCritical, "NO CODE ON SHEET TO CREATE PDF"
Exit Sub
End If
If .Range("N1") = "M" Then
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DISCO II CODE\DISCO II PDF\" & .Range("B3").Value & " " & Format(.Range("E3").Value, "dd-mm-yyyy") & " " & .Range("Q1").Value & " (SLS).pdf"
.Range("A1:K23").ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
Else
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DISCO II CODE\DISCO II PDF\" & .Range("B3").Value & ".pdf"
.Range("A1:K23").ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
End If
With ActiveSheet
' ActiveWindow.SelectedSheets.PrintOut copies:=1
Unload PrinterForm
.Range("B3").Select
Application.ScreenUpdating = False
Dim c As Range
Dim ans As String
Dim Lastrow As Long
ans = ActiveCell.Value
Workbooks.Open ("C:\Users\Ian\Desktop\REMOTES ETC\DR\DR.xlsm")
Lastrow = Sheets("POSTAGE").Cells(Rows.Count, "B").End(xlUp).Row
For Each c In Sheets("POSTAGE").Range("B1:B" & Lastrow)
If c.Value = ans Then Application.Goto Reference:=Sheets("POSTAGE").Range(c.Address): Exit Sub
Next
Application.ScreenUpdating = True
End With
End With
End Sub